Forum Discussion
HTTP to HTTPS redirect with URI editing.
- Feb 14, 2018
Ok got the solution following rule works.
when HTTP_REQUEST { if {[HTTP::uri] contains "/IT/Team/"} { set uri [string map {"/IT/Team/" "/location/"} [HTTP::uri]] HTTP::redirect "https://xyz.com$uri" } }
Ok got the solution following rule works.
when HTTP_REQUEST { if {[HTTP::uri] contains "/IT/Team/"} { set uri [string map {"/IT/Team/" "/location/"} [HTTP::uri]] HTTP::redirect "https://xyz.com$uri" } }
you can simplify it with this code (HTTP::path instead of HTTP::uri, starts_with instead of contains):
when HTTP_REQUEST {
if {[HTTP::path] starts_with "/IT/Team/"} {
HTTP::redirect "https://xyz.com[string map {"/IT/Team/" "/location/"} [HTTP::uri]]"
}
}
of use a policy with action (version 12 minimum):
redirect location : tcl:https://xyz.com[string map {"/IT/Team/" "/location/"} [HTTP::uri]]
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