Forum Discussion
Robb_Holzer_770
Nimbostratus
Aug 09, 2006IRule Redirect Question
I am trying to setup an iRule for 9x that simply reads an HTTP header and then redirects to a new URL....
My rule currently is follows but is not working, suggestions on what I might try?
when HTTP_REQUEST {
if { [HTTP::host] eq "http://www.tq3navigant.com/northcentral"} {
HTTP::redirect "http://www.navigant.com/About/Locations/LocationsDetail.aspx?Region=NC&Hemi=West[HTTP::uri]" }
}
Thanks!
2 Replies
- hoolio
Cirrostratus
You can add a logging statement to the rule to find out what host you're making the comparison against:when HTTP_REQUEST { if { [HTTP::host] eq "http://www.tq3navigant.com/northcentral"} { log local0.info "Host: [HTTP::host]" HTTP::redirect "http://www.navigant.com/About/Locations/LocationsDetail.aspx?Region=NC&Hemi=West[HTTP::uri]" } }
The output will be logged to /var/log/ltm.
I think you'll find the Host header doesn't include the protocol or the URI. Here is the format:
http://myhost.com/myUri/
where http is the protocol, myhost.com is the host and /myUri/ is the URI.
So you would want to match against "www.tq3navigant.com"
Aaron
[with edits for typing faster than I was thinking...] - Chad_Roberts_21
Nimbostratus
hoolio's answer is technically accurate--and you may already have put his advice to good, functional use--but for the sake of being thorough, and because I need all the practice I can get, I believe this is the way you would want that iRule of yours to be written:when HTTP_REQUEST { if { "[HTTP::host][HTTP::uri]" eq "www.tq3navigant.com/northcentral"} { HTTP::redirect "http://www.navigant.com/About/Locations/LocationsDetail.aspx?Region=NC&Hemi=West[HTTP::uri]" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
