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
- 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]" } } }
http://www.foo.com/onething/morethings
when HTTP_REQUEST { if { [HTTP::uri] ends_with "/morethings" } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
- rodrigo_Benzaqu
Nimbostratus
Thanks Joe. But I want to redirect only if : - Just change the match pattern in the switch statement:
when HTTP_REQUEST { switch -glob [HTTP::uri] { "/abcd/*" - "/efgh/*" - "/ijkl/*" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } }
http://www.foo.com/aaaa/abcd/*
- rodrigo_Benzaqu
Nimbostratus
Joe, Sorry I think I´m not explaining my problem correct. - hoolio
Cirrostratus
I think Joe is suggesting using the switch command with strings instead of a regex because it's more resource intensive to use a regex.when HTTP_REQUEST { switch -glob [HTTP::uri] { /???/* { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } }
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