Forum Discussion
N_67263
Nimbostratus
Sep 29, 2013need help with a iRule.
Folks,
I need to work on a iRule which accepts a request on http and forward a particular page to http only.
All other are redirected on https.
e.g. http://testsite.com/support/Lic --> http://te...
StephanManthey
Nacreous
Sep 30, 2013The approach will be to to filter the matching HTTP::host and HTTP::path and to use a pool. In case of no match a redirect applies.
Make sure to use a 'string tolower' to compensate varying cases.
There is another option to cover the query part of the URI as well (the stuff after the question mark). The full URI (containing both the path and separated query) will be used in combination with the original hostname for a redirect to https by using the following sample code:
when HTTP_REQUEST {
if {([string tolower [HTTP::host]] eq "testsite.com") && ([string tolower [HTTP::path]] eq "/support/lic")}
pool pool_of_licservers
} else {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}Help 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