Forum Discussion
To redirect https to http
How to redirect if somebody key in manually the https://www.test.com instead of http://www.test.com? The page will show certificate error if we key in https. How the iRules will be?
Thank you in advance.
2 Replies
- Tariq_Akram
Nimbostratus
The real situation is like this. I have 1 info page named as http://www.test.com. Inside this info page has a link to my secure site https://www.testonline.com (with secure cert). My problem is if somebody key in manually the https://www.test.com instead of http://www.test.com, The page will show certificate error and cannot redirect to http.
My target is to if somebody key in the https://www.test.com it can be redirect to http://www.test.com page and without certificate error message
Can somebody advise me the solution. Thank you in advance.
- Henrik_S
Nimbostratus
This is related to how the SSL connection is established and how the browser is supposed to present the user with a warning if he connects to a server that presents a certificate that doesn't contain the www.test.com FQDN in either common name or subject alternate name fields.
So to clearify:
- You will need a certificate which includes www.test.com or *.test.com in either common name or subject alternate name. This certificate must again be signed by a CA that the clients browsers trust.
- You will need to create a custom clientssl profile that uses the above certificate
-
You will need to create a custom iRule:
when HTTP_REQUEST {HTTP::redirect http://[getfield [HTTP::host] ":" 1][HTTP::uri] }
-
You will need to create a virtual server that listens on the same VIP as the one you use for the normal HTTP virtual server. On this you will need to bind a HTTP profile and the above mentioned iRule.
While I was typing my reply, you updated your question. So, in that case, you need to have two certificates or a SAN certificate that covers both www.test.com and www.testonline.com and bind both two your HTTPS VS.
For the iRule, the correct syntax would then be:
when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "www.test.com" { HTTP::redirect http://[getfield [HTTP::host] ":" 1][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