RobW
Mar 25, 2008Nimbostratus
302 redirect
High my name is Rob and I'm iRule challenged. I'm running v9.4.4 and I have a 443 virtual server with client side SSL processing. I need to handled 302 status codes differently depending on the returned server port.
The conditions are as follows:
302 port 81 process through https - Currently working using either iRule listed below.
302 port 443 process through https - Currently working using either iRule listed below.
302 port 80 process/redirect via http - Currently not working using either iRule listed below.
HTTP Watch out - 302 redirect port 80
00:00:00.000HTTP 404 Not Found
+ 0.0000.0451491348GET302Redirect to https://www.testurl.com/ports/index.htmlhttps://www.allnewstest.com/suitetest/portal/linkhandler.do?url=http%3A//www.testurl.com/ports/index.html
+ 0.0470.300297588GET404text/htmlhttps://www.testurl.com/ports/index.html
0.34717889362 requests
when HTTP_RESPONSE {
if {([HTTP::status] starts_with "3") and ([TCP::server_port] equals "81")} {
HTTP::header replace Location [string map {http: https:} [HTTP::header value Location]]
}
elseif {([HTTP::status] starts_with "3") and ([TCP::server_port] equals "80")} {
SSL::disable}
}
when HTTP_RESPONSE {
if {([HTTP::status] starts_with "3") and ([TCP::server_port] equals "81")} {
HTTP::header replace Location [string map {http: https:} [HTTP::header value Location]]
}
elseif {([HTTP::status] starts_with "3") and ([TCP::server_port] equals "443")} {
HTTP::header replace Location [string map {https: https:} [HTTP::header value Location]]
}
elseif {([HTTP::status] starts_with "3") and ([TCP::server_port] equals "80")} {
HTTP::header replace Location [string map {http: http:} [HTTP::header value Location]]
}
}
Thanks,
Rob