Forum Discussion
Unixian_307588
Nimbostratus
Nov 19, 2018Redirect specific urls on VS
Hi Guys,
I have 1 VS listening on port 80. This VS serves a website and also redirects requests. What kind of Irule would help me to exlude 1.domain.com from redirection. And redirect every other domain requests from 80 to 443?
Thanks in advance.
- Unixian_307588
Nimbostratus
I had the following irule in mind:
when HTTP_REQUEST { Check if domain is "www.domain.com" if {[string tolower [HTTP::host]] eq "1.domain.com"}{ Exit this event from this iRule return } } } Redirect everything else to HTTPS HTTP::redirect "https://[HTTP::host][HTTP::uri]
- RossVermette
Nimbostratus
You could do something similar to this: (Note I have not tested this)
when HTTP_REQUEST { switch -glob [string tolower [HTTP::host]] { "domainame.noredirect.com" - "domainname2.noredirect.com" { pool poolname_pool } default { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } }
- Lee_Sutcliffe
Nacreous
You can make it simpler if you reverse the logic and use an 'if not(!)'
when HTTP_REQUEST { if {!([string tolower [HTTP::host]] eq "1.domain.com")} { 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