Scott_85950
Nov 13, 2010Nimbostratus
Root Domain Redirect Retaining Query String
www.mysite.com/?s_cid=ThisIsATest --> www.mysite.com/guest/en/home.shtml?s_cid=ThisIsATest
when HTTP_REQUEST {
if { [HTTP::path] equals "/" } {
HTTP::redirect "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]" }
}
}
SOL9952: The HTTP::path iRule command may return more information than expected
https://support.f5.com/kb/en-us/solutions/public/9000/900/sol9952.html
virtual bar {
snat automap
pool foo
destination 172.28.17.55:80
ip protocol 6
rules myredirect
profiles {
http {}
tcp {}
}
}
rule myredirect {
when HTTP_REQUEST {
if { [URI::path [HTTP::path]] eq "/" and [HTTP::query] ne ""} {
HTTP::redirect "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]"
}
}
}
curl -I http://172.28.17.55
HTTP/1.1 200 OK
Date: Sat, 13 Nov 2010 07:28:33 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Thu, 11 Nov 2010 04:23:21 GMT
ETag: "1315d-5f-5580a040"
Accept-Ranges: bytes
Content-Length: 95
Content-Type: text/html; charset=UTF-8
curl -I http://172.28.17.55/?s_cid=ThisIsATest
HTTP/1.0 302 Found
Location: http://172.28.17.55/guest/en/home.shtml?s_cid=ThisIsATest
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
when HTTP_REQUEST {
if { [URI::path [HTTP::path]] eq "/" and [HTTP::query] ne ""} {
HTTP::respond 301 "Location" "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]"
}
}
when HTTP_REQUEST {
if { [HTTP::path] eq "/" and [HTTP::query] ne ""} {
HTTP::respond 301 "Location" "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]"
}
}