Forum Discussion
HTTPS to HTTP irule
I'm trying to get an irule to work, but can't figure out what's wrong. What I'm wanting to do is redirect an https request on one url to a http on a different url. The rule that's not working is:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "somedomainname.com/coatty/" && [TCP::local_port] == 443 } { HTTP::redirect "http://somedomainname.com[HTTP::uri]" } }
Thanks
6 Replies
- Cory_50405
Noctilucent
HTTP::uri will only contain the /coatty portion. somedomainname.com is the HTTP::host. Try this iRule:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/coatty" && [TCP::local_port] == 443 } { HTTP::redirect "http://somedomainname.com[HTTP::uri]" } } - drew_23351
Nimbostratus
Thanks... Now how would I get the redirect to remove the /coatty part?
- Cory_50405
Noctilucent
Do you want to redirect without preserving the URI, or redirect preserving the URI with the exception of the /coatty portion?
- drew_23351
Nimbostratus
with out preserving the uri. https://www.somedomain.com/coatty to http://www.someotherdomain.com
- drew_23351
Nimbostratus
found it....remove the [HTTP::uri] at the end of the redirect.
- Cory_50405
Noctilucent
Correct. You should be all set now.
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