Forum Discussion
URI redirect to append / if not present in the HTTP:URI string already
I have an an iRule which is evaluates the URI "/xyz". I want the operator to be equals not starts_with as this is starting to cause issues in which nodes or pools are used based on where the statement sits in the rule. Right now equals does not work due to the WebServer sending a 302 to the the client appending the / in the URI which breaks the rule and any other paths to render the page such as css jpg etc.
We want to try and take the 302 away from the WebServer and redirect using the F5. Below is the code snippit as an example where I am are re-directing to ssl using the ssl profile path.
when HTTP_REQUEST {
set SSL [PROFILE::exists clientssl]
if { [HTTP::uri] starts_with "/xyz" } {
node 192.168.1.1:8080
if { not $SSL } { HTTP::respond 302 Location "https://[HTTP::host][HTTP::uri]" }
}
}
I am wondering what is the best way to accomplish this.
- Shaun_Simmons1Altostratus
Possibly the below? The idea is to take the webserver 302 away and replace it again with the same by the F5.
when HTTP_REQUEST { set uri [HTTP::uri] if { $uri equals "/xyz" } { set uri "/xyz"} HTTP::uri $uri }
- Shaun_Simmons1Altostratus
My Answer is a bit flawed to encompass part of your iRule. Let me get back to you.
Recent Discussions
Related Content
* 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