both ssl and non-ssl on single port

Posted by Zulakis on Server Fault See other posts from Server Fault or by Zulakis
Published on 2012-09-22T15:34:48Z Indexed on 2012/09/22 21:40 UTC
Read the original article Hit count: 314

Filed under:
|

I would like to make my apache2 webserver serve both http and https on the same port.
With the different method i tried it was either not working on http or on https..

How can I do this?

Update:
If I enable SSL and then visit the with http I get page like this:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
<blockquote>Hint: <a href="https://server/"><b>https://server/</b></a></blockquote></p>
<hr>
<address>Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny16 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g Server at server Port 443</address>
</body></html>

Because of this, it seems very much possible to have both http and https on the same port.
A first step would be to change this default-page so it would present a 301-Moved header.

Update2: According to this, it is possible. Now, the question is just how to configure apache to do it.

© Server Fault or respective owner

Related posts about apache2

Related posts about ssl