Forum Discussion
Sivaraj_6072_25
Nimbostratus
Apr 01, 2016iRule Redirection
Hi,
I am new to iRule section.
I have an iRule for http to https redirect and applied to a virtual server, So any traffic coming through my virtual server will be redirected to https.
when HTTP...
Hannes_Rapp
Nimbostratus
Apr 01, 2016when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] ends_with "oldsite.com") && ([HTTP::path] eq "/") } {
Intercept with a redirect to http://www.newsite.com
HTTP::respond 301 Location "http://www.newsite.com/" Connection Close
} elseif { ([string tolower [HTTP::host]] ends_with "oldsite.com") && ([HTTP::path] ne "/") } {
Forward traffic to HTTP pool
pool NameOfMyHTTPpool80
} else {
Generic HTTP to HTTPS redirect (ORIGINAL request Host and URI are retained)
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]" Connection Close
}
}
- Sivaraj_6072_25Apr 01, 2016
Nimbostratus
Hannes, This is perfect. but for some reason the second condition is not working. It is not sending traffic to the Pool. So I get connection reset error when I browse http://newsite.com/xyz. any idea? Thanks, Siva. - Sivaraj_6072_25Apr 01, 2016
Nimbostratus
Small correction, i tried http://oldsite.com/xyz. And sites doesn't load at all. Finally it throws connection reset error. I verified the pool name and everything looks good. Thanks, Sivaraj. - Hannes_RappApr 02, 2016
Nimbostratus
Perhaps a conflict with another iRule? Do you see anything in /var/log/ltm ? Also, please provide output for your VS config: 'tmsh list ltm virtual YourVSName' - Sivaraj_6072_25Apr 09, 2016
Nimbostratus
Hi Hannes, Thank you so much for the iRule, It really helped us.There was an issue with SNAT,just rectified it.
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