Forum Discussion
Need help to redirect all url from http to https
Hi together,
the topic of your question does not match the iRule sample code.
Please clarify.
Regarding the thread´s subject:
There is a built-in iRule to redirect from http to https (/Common/_sys_https_redirect):
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}It takes the original hostname and uri into account and takes care of service port settings.
It just needs to be assigned to your virtual servers listening i.e. on port 80. These servers will need an http-profile and this iRule. Done.
Regarding the iRule code. It can be optimized a bit i.e. as follows:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/test1*" { pool test1_Pool }
"/test2*" { pool test2_Pool }
"/test3*" { pool test3_Pool }
"/test4*" { pool test4_Pool }
default { pool [LB::server pool] }
}
}Thanks, Stephan
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