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
hoolio
Cirrostratus
Aug 02, 2007I think Joe is suggesting using the switch command with strings instead of a regex because it's more resource intensive to use a regex.
You can use the question mark as a wildcard representing any single character. So this should match what you've described so far, where any request that starts with /, any three characters, another forward slash followed by anything would be redirected to the same host and URI via HTTPS:
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
/???/* {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}You can check the TCL man page on switch (Click here) and string match (Click here) for details on string wildcards.
Aaron
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