Forum Discussion
David_Bohls_209
Mar 03, 2011Nimbostratus
301 Redirect to different port (iRule "Rewrite Redirect"
I currently have an issue where a client of mine is producing (301 302 305 etc...) redirects for certain traffic arriving on http://www.url.com:8081. The current iRule was not set up by me, and I bel...
Hamish
Mar 03, 2011Cirrocumulus
That's because your iRUle is simply replacing http:// with https://. My more generic one that I usually implement uses the host: header to generate the redirect. e.g. (No checking, so probably some typos in here)
when HTTP_REQUEST {
Check if Host header value has a length
if {[string length [HTTP::host]]}{
Redirect to the requested host and URI (minus the port if specified)
log local0. "ssl-redirect-301 https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
HTTP::respond 301 Location https://[getfield [HTTP::host] ":" 1][HTTP::uri]
} else {
Redirect to VIP's IP address
log local0. "ssl-redirect-301 https://[IP::local_addr][HTTP::uri]"
HTTP::respond 301 Location https://[IP::local_addr][HTTP::uri]
}
}
H
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