Forum Discussion
Explain Irule
Dear Experts,
Can someone explain me the below iRule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "[www.website.com](http://www.website.com)" } then {
HTTP::redirect "http://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
}
1 Reply
- Minn_62043
Cirrostratus
"getfield" part is to strip out the ports from the domain part, and redirect the user to it. For example, if the HTTP Host header is user will be redirected to http://www.domain.com.
There is a condition that tests the HTTP Host header equals to www.website.com. It means, if a user is browsing to http://www.website.com:80/uri or http://www.website.com:443/uri, the iRule will redirect the user to http://www.website.com/uri only.
However, if the domain is [HTTP::host] will likely to be www.website.com:8443 and it will fail the test, and users will not be redirected.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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