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 would like to map all traffic on 80 and 443 from to an internal server: I have a VirtualHost (Apache 2.2 on Ubuntu) setup as follows (note, I had to break up the hyperlinks below because I am a 'new user'):

<VirtualHost *:80>
  ServerAlias *
  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
    Order deny,allow
    Allow from all

  ProxyPass /
  ProxyPassReverse /

And that works great for http traffic. However, I can't seem to do the same thing for https. I have tried:

  • Changing VirtualHost *:80 to * - but that doesn't work (I need it http->http and https->https)

  • Creating a new VirtualHost entry for *:443 that redirects to, but that fails as well (browser timeouts)

I did some searching, here and elsewhere, and the closest question I could find was this, but that didn't quite answer it.

Also, just out of curiosity, I tried mapping all ports to https (by changing the two ProxyPass lines from http to https (and removing the :80 from VH), and that didn't work either. How would you do that as well?

Any thoughts? Thanks in advance.

share|improve this question
up vote 4 down vote accepted

This used to work for me

<VirtualHost *:443>                                                                                                                                                                        
 SSLProxyEngine on                                                                                                                                                                          
 <Location />                                                                                                                                                                               
share|improve this answer
The answer, it turns out, was that I was missing the "SSLProxyEngine on" command in my config file. So the complete file is: <VirtualHost *:443> ServerName ServerAlias * SSLProxyEngine On ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / ProxyPassReverse / </VirtualHost> – Joshua Ball Jun 30 '09 at 23:51
Thanks a lot! Works perfectly! – Marçal Juan Jan 12 '15 at 20:55

The following works for me:

<VirtualHost A.B.C.D:443>

    ProxyPass /
    ProxyPass /

(Where A.B.C.D is your public IP address, obviously)

share|improve this answer
The second ProxyPass seems to be missing a "Reverse". – Law29 Mar 7 at 22:04

I would personally skip Apache entirely and use IPTABLES to forward all traffic on 80 and 443 to the required IP, would imagine this would give greater performance.

(Assumes you have access on the machine to edit the firewall rules).

$iptables -A PREROUTING -t nat -i $EXTIF -p tcp --dport 80 -j DNAT --to
$iptables -A FORWARD -p tcp -m state --state NEW -d --dport 80 -j ACCEPT

brief exert from my firewall where I do just what you are trying to do.

share|improve this answer

If you want all the request to be redirected to the secure network i.e. throught https the add the following:

<VirtualHost *:443>
  ServerName ngmlx441
  SSLEngine on
  KeepAliveEnabled ON
  SSLProtocol all
  SSLProxyEngine on
  SecureProxy ON
  SSLProxyEngine on
  SSLCertificateFile /etc/httpd/conf.d/servername.crt
  SSLCertificateKeyFile /etc/httpd/conf.d/servername.key
  SSLCACertificateFile /etc/httpd/conf.d/orgination.crt
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.