Forum Discussion
Scott_85950
Nov 13, 2010Nimbostratus
Root Domain Redirect Retaining Query String
- Scott_85950NimbostratusExpected behavior:
- nitassEmployeewhat about this one?
when HTTP_REQUEST { if { [HTTP::path] equals "/" } { HTTP::redirect "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]" } } }
- nitassEmployeei a little bit modified rule according to sol9952. pls feel free to revise.
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
- Scott_85950NimbostratusThank you, this works great. I am going to slightly modify with the following for a 301 redirect. As well, thank you for the information on the limitation of the URI:path prefix in SOL9952. I believe for our application of this iRule, I don't foresee this as a problem, but will test to be sure.
- nitassEmployeeu're welcome. :-)
- Scott_85950NimbostratusUpdate; with further testing, we found that there were JavaScript errors generated by new queries being added to the URL when navigating in the site. We've further revised the iRule and are testing again to verify conflicts.
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