Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.

HTTPS & SSH.

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? –  thefinn93 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. –  thefinn93 Feb 13 '12 at 19:53
1  
@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! –  thefinn93 Feb 14 '12 at 3:12

Your Answer

 
discard

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.