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 an apache server v2.2, with a virtual host on 80 and another with SSL on 444. I would like to redirect all this kind of request:


(without https on SSL port) to


In order to avoid error 400 Bad request. Do you know how it can be done ?

Thanks in advance.

share|improve this question

You can't do that. If you have enabled SSL on port 444, a connection without SSL to that port simply will not work.

share|improve this answer

Apache cannot do this directly. When it listens on a port, it is listening for either plain HTTP traffic or HTTPS traffic and the other type of connection will just fail.

A clever application, however, can try to inspect the initial connection data, decide what sort of connection is being attempted, and take appropriate action. sslh does this. To use it, you will have to set up two Apache virtual hosts , each listening on a different port on the localhost address. With those in place, you would have sslh listen on port 444 and forward HTTP and HTTPS traffic to the appropriate internal ports.

share|improve this answer

Just set your configuration to use redirect of mod_alias:

<VirtualHost *:80>
    Redirect permanent /
</VirtualHost >

Source: mod_alias#redirect

share|improve this answer
I don't think that helps John. He appears to want to be able to accept HTTP and HTTPS traffic on the same port. Your solution only accepts HTTP on port 80 and HTTPS on port 443. – asciiphil Jun 3 '13 at 17:38
I can confirm. I dont want to accept both request's type, but at least redirect HTTP to HTTPS. It seems that asciiphil's solution is the best way... – John Jun 4 '13 at 10:38

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.