Forum Discussion
HTTP redirect to HTTPS and add domain but leave it off if already added
Two scenarios here.. user enters or
Getting to become is done with this part of the iRule
when HTTP_REQUEST { if {([HTTP::host] contains "vipaddress")} then { HTTP::redirect "https://[HTTP::host].example.local" } } (This returns from just
I am having issues with what to do if the user enters so it doesn't add an additional .example.local at the end. I'm failing on the elseif part. Also if a user enters vipaddress/sitefolder/site would the redirect be "https://[HTTP::host]/[HTTP::uri]"
- Stanislas_Piro2
Cumulonimbus
Hi,
why do you want to add if you know the expected result?
try this code:
when HTTP_REQUEST { switch [HTTP::host] { "vipaddress" - "vipaddress.example.local" { HTTP::redirect "https://vipaddress.example.local[HTTP::uri]" } } }
you can also try this:
when HTTP_REQUEST { switch [HTTP::host] { "vipaddress" - "vipaddress.example.local" { HTTP::redirect "https://[getfield [HTTP::host] "." 1].example.local[HTTP::uri]" } } }
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