Forum Discussion
Randy_Johnson_L
Nimbostratus
Mar 06, 2017Evaluate full URL for empty URI / Path ?
I need to deploy an iRule that will perform a redirect, based on the HTTP::uri or HTTP::path being empty.
This needs to take into account a user trying 'http://server.company.com' and 'http://server....
Stephane_Viau
Nimbostratus
Mar 06, 2017Randy, can you show what your iRule looks like? Only advice I have for now is to use HTTP::path for the condition because HTTP::uri also contains the query string so depending on how you built your condition, you might get unexpected results.
So I would do something like this (note that I added [HTTP::uri] in both redirects in case you need to keep the query string) :
if { ([HTTP::path] eq "" ) or ([HTTP::path] eq "/")} {
HTTP::respond 301 Location http://server.company3.com[HTTP::uri]
}
else {
HTTP::respond 301 Location http://server.company2.com[HTTP::uri]
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
