Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to get apache to redirect from http to https, however I want them both on the same port (20100, but I doubt that will matter). Basically what's going on here except I'm not doing this for webmin. Currently I have it configured to serve HTTPS, and when I access with HTTP I get:

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

There seem to be a lot of somewhat similar questions, however I am unable to find one that actually answers my question.

share|improve this question
up vote 6 down vote accepted

This is not going to be possible with Apache. With Apache you cannot have HTTPS and HTTP running on the same port.

I am aware of a few port-multiplexers designed to make HTTPS/OpenVPN or SSH run on the same port, but these require additional software. I am not aware of tools that will multiplex HTTPS and HTTP.


share|improve this answer
Damn. Oh well. Would it be possible to have apache simply redirect to the HTTPS version of the page from the HTTP version? – Finn Feb 13 '12 at 11:35
Sure. do a quick search here there are many questions that cover that. – Zoredache Feb 13 '12 at 15:37
Yeah so I've discovered, however they all assume that you're running http on port 80 and https on port 443. None (that i could find) work for to redirect http requests to https on the same port. – Finn Feb 13 '12 at 19:53
@thefinn93 The same port still won't work in Apache, regardless of what you're trying to answer with - a full page or a redirect. You need software in front of the listener that can make decisions on request routing based on the protocol the client sends - HAProxy may do the trick. But why go through all this effort - why not just use a different port? – Shane Madden Feb 13 '12 at 23:24
Alright. I assumed since apache was able to serve up something on that page it should be able to serve up redirect. Oh well, not really that important. Thanks! – Finn Feb 14 '12 at 3:12

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.