Forum Discussion
Help with http to https redirect
Hello,
Grateful for any assistance with the following issue.
We have one VS serving http and https traffic for domain1.org. The redirect from http to https is done via HTTP Class profile:
Local Traffic > Profiles > Protocol > HTTP Class > http2https:
Parent Profile: httpclass
Hosts: Match all
URI Paths: Match all
Headers: Match all
Cookies: Match all
Send To: Redirect to
Redirect to Location: https://[getfield [HTTP::host] ":" 1][HTTP::uri]
This works perfectly fine for domain1.org.
Now we would like to add additional domain: domain2.org, pointing to the same IP address, however there is no SSL certificate deployed for domain2.org. So when users enter http://domain2.org, they are redirected to https://domain2.org, which generates a warning about certificate mismatch. If accepted it redirects to https://domain1.org.
Is there any way to configure a VS to redirect from http://domain2.org to https://domain1.org? Do I need to create a separate VS (with a separate IP for domain2.org)?
Thank you.
5 Replies
- El_Jefe_43496
Nimbostratus
I would use an iRule to do this - something along these lines : when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with ".domain2.org" } { HTTP::redirect "https://www.domain1.org[HTTP::uri]" } }
- nov1ce_120072
Nimbostratus
Thank you, it worked!
- El_Jefe
Nimbostratus
I would use an iRule to do this - something along these lines : when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with ".domain2.org" } { HTTP::redirect "https://www.domain1.org[HTTP::uri]" } }
- nov1ce_120072
Nimbostratus
Thank you, it worked!
- What_Lies_Bene1
Cirrostratus
I'm afraid I disagree. I'd modify your class and change it to this;
Redirect to Location: https://domain1.org/[HTTP::uri]
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