Forum Discussion
Andrea_Knapp_28
Nimbostratus
Oct 19, 2007REdirect HTTP -> HTTPS based on IP
In Version 4.5 I had a simple rule that went as follows:
if (server_addr == 11.11.11.11) {
redirect to "https://www.yourdomain.com/%u"
}
else {
discard
}
So this would redirect any url that came in with IP address of 11.11.11.11 and forced it to change the URL to the new name. So if I typed http://yourdomain.com it would force it to https://www.yourdomain.com.
With V9 I am having issues having the same affect. I have the following:
when HTTP_REQUEST { if { [HTTP::host] eq "11.11.11.11" } {HTTP::redirect "https://www.yourdomain.com[HTTP::uri]"} else { discard }}
Now this only works if you enter the physical IP address. However if you enter the URL for this it does not work, it just spins.
I also havce changed it to:
when HTTP_REQUEST { if { [HTTP::host] eq "www.yourdomain.com" } {HTTP::redirect "https://www.yourdomain.com[HTTP::uri]" } else { discard }}
Any suggestions how I can force this by ready the IP that comes so I do not have to write multiple lines for each URL that I want to force that uses that same IP address.
Thank you,
Andrea
- hoolio
Cirrostratus
Hi,when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] }
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