Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple websites on my server, and just one of them is through https (say :

But if an user tries to access to, he got a warning about an invalid SSL certificate, dedicated to and wrong for (obviously!).

I'd like to redirect every https request that is not for to the original host, but in http, is this possible?

To be clear :

Is this possible via iptables? if so, how?

Thank you for your help, I appreciate :)

share|improve this question
up vote 2 down vote accepted

Alternatives to solve the warning problem would be one of the following

  • Close the https port all together (port 443)
  • Buy a SSL-certificate that is valid for all domains
  • Put the https-site on a seperate IP-address, and only open port 443 on that IP.

If you absolutely want to use a redirect, you would have to send the redirect to the browser after the SSL-certificate have been presented to the browser, and then also after the warning have shown. There is probably some way you could redirect port 443 to port 80 with iptables, but I do not know of any method that would do that in a "good" method, as a browser requesting a site over https assumes it meets a SSL-enabled site.

share|improve this answer
if the secured site will be on separate IP, why would he need cert for all domains? – Sunny Jul 1 '11 at 13:42
If you read the first sentence, it says "(...) one of the following" He would not need a certificate for all domains if he put the secured site on a seperate IP. I'm sorry if I didn't make that clear. – eriktm Jul 1 '11 at 13:44
Ops, didn't see that. But then, how is the first option (close 443) is solution at all, he'll not have ssl for admin site? – Sunny Jul 1 '11 at 13:49
still, you have +1 – Sunny Jul 1 '11 at 13:49
Closing port 443 would stop the SSL-warning from being shown, which is what I have given alternatives to in the first part of my answer. – eriktm Jul 1 '11 at 13:51

You could not redirect https traffic to http. This redirect must be seen by the browser, to know, that there will be non-SSL Traffic.

You should either buy a valid SSL Certificate with is widely trusted, or close the https port.

You could redirect via some configuration parameters for Apache, but you will still get the warning first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.