Forum Discussion
SantoshGowda_32
Nimbostratus
Feb 26, 2019Need your assistance to create a F5 redirection rule for /user/login.seam -> /login
Please let me know whether below irule is correct or not:
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "/user/login.seam" } {
HTTP::uri [string map {"/user/login.seam" "/login"} [HTTP::uri] ]
}
- Snl
Cirrostratus
give a try
option 1
when HTTP_REQUEST{ if { [string tolower [HTTP::uri] ] ends_with "/user/login.seam" } { HTTP::uri [string map {"/user/login.seam" "/login"} [HTTP::uri]] HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
option 2
when HTTP_REQUEST { if { ( [string tolower [HTTP::uri]] ends_with "/user/login.seam" } { set uri [HTTP::uri [string map {"/user/login.seam" "" "/login" ""} [HTTP::uri]]] HTTP::redirect "https://[HTTP::host]$uri" } }
- CharlesCS
Cirrus
I would use
rather thanHTTP::path
, because the URI could include a query string and hence the comparison would fail.HTTP::uri
when HTTP_REQUEST { if { [HTTP::path] ends_with "/user/login.seam" } { HTTP::path [string map {"/user/login.seam" "/login"} [HTTP::path] ] } }
- CharlesCS
Cirrus
As Michael noted, you must be careful with upper/lower case comparisons. For completeness' sake, this ought to work in all cases (no pun intended):
when HTTP_REQUEST { if { [string tolower [HTTP::path]] ends_with "/user/login.seam" } { HTTP::path [string map -nocase {"/user/login.seam" "/login"} [HTTP::path] ] } }
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