Forum Discussion
rodrigo_Benzaqu
Nimbostratus
Aug 02, 2007SSL redirection rule with regular expresion
Hi Guys,
I need to create a rule to redirect
/???/morethings to https://???/morethings
Do you think that is possible ?
Thanks
Rodrigo
Aug 02, 2007
Sure you can do that. Make sure this iRule is on your HTTP virtual and not your HTTPS virtual or else you'll get into a circular loop.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/*/morethings" {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
This will match the following
http://www.foo.com/onething/morethings
http://www.foo.com/onething/twothing/morethings
...
It will not match this:
Now, if you just want to make sure that your URI ends with "/morethings" you can do something simple like this:
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "/morethings" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
Hopefully this will get you going in the right direction.
-Joe
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