Forum Discussion
Abdul_Ghani_Eli
Nimbostratus
Dec 13, 2006Https redirection
Hi
Can someone advise me on an issue i have regarding about Https redirection. Currently i'm using the below iRules to do it
}
rule http_redirect {
when HTTP_REQUEST {
...
Nathan_McKay_67
Nimbostratus
Dec 13, 2006One thing to keep in mind is that your iRule will only redirect as long as the user agent (browser) supplies a HTTP host header. If not, the LTM will not return a valid redirect - the link will be more along the lines of "http:///[URI]". This probably isn't going to be a big deal most of the time, but it pays to be thorough. Here's what I did:
when HTTP_REQUEST {
if { [ string length [ HTTP::host ] ] > 0 } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
HTTP::redirect "https://[IP::local_addr][HTTP::uri]"
}
}
So if the HTTP host header is not supplied, we at least redirect them to the IP of the virtual server to which they are currently connected. There may be better ways to do this, but this has been working great for me.
Thanks,
Nathan
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