Forum Discussion
JEHRS_288007
Nimbostratus
Oct 19, 2016Removing /string/ from URL
Hello,
I would like create a iRule which removes only a /string/ from a URL and this is given to a pool of tomcat servers. Which practice would have the less impact on the performance?
Than...
Jinshu
Cirrus
Oct 19, 2016Try something like this..
Option 1
If you want to redirect to new URI from client browser, try below irule. When using this, client would be able see the new url (after removing /string). [URI Redirect method]
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/string"}{
set newuri [string map -nocase {"/string" ""}[HTTP::uri]]
HTTP::redirect "http://[HTTP::Host]$newuri"
}
}
Option 2
If you dont want client to see the new url, try below irule. On the client browser it won't make any changes but the backend it will remove /string. [URI Rewrite method]
`when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] starts_with "/string"}{
set newuri [string map -nocase {"/string" ""}[HTTP::uri]]
HTTP::uri $newuri
}
}
-JinshuHelp 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