Forum Discussion
HTTPS to HTTP iRule Redirection
We recently shut down the nodes on a VIP that is no longer in use, but I would like traffic to be redirected to our new VIP if customers hit the old page. An HTTP redirect iRule works perfectly fine on the HTTP version of the old page, but I cannot get it to work with the HTTPS version. For example:
http://oldpage.website.com correctly redirects to http://website.com/newpage https://oldpage.website.com does not redirect to http://website.com/newpage
The iRule we use for redirection is as follows:
when HTTP_REQUEST {
if { [HTTP::host] eq "oldpage.website.com" } {
HTTP::redirect "http://website.com/newpage"
}
}
I created a Client SSL profile for the site and applied it to the HTTPS VIP, but traffic is still not redirecting. I've matched the Old HTTPS VIP configuration to be identical to the Old HTTP VIP configuration, with the only difference being the Client SSL profile.
Can anyone please explain what I'm missing?
4 Replies
- nathe
Cirrocumulus
What happens if you view the http request/response in fiddler, http fox? any clues here?
I wonder if HTTP::respond might work better, try:
HTTP::respond 301 Location "http://website.com/newpage"
See if this helps.
301 is better as it's a permanent move so search engines will cache this. A redirect it won't
N
- giltjr
Nimbostratus
Were you offloading the SSL to the F5 on the old HTTPS VIP? Can you add some logging to the iRule
when CLIENT_ACCEPTED { if {[TCP::local_port] eq 443 } {set SSL 1} else {set SSL 0} } when HTTP_REQUEST { if {$SSL} {log local0. "Request is SSL and Host is [HTTP::host]} if { [HTTP::host] eq "oldpage.website.com" } { HTTP::redirect "http://website.com/newpage" } } - gweatherall_148
Nimbostratus
It turns out my iRule was written correctly. However, it probably would have helped if I had set it up on the active F5 instead of the standby!
- kridsana
Cirrocumulus
So after you config on active unit , it's working fine?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
