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 have an open server that's running Apache and a closed server that's also running Apache and that's behind a firewall and running a VPN.

I'm trying to forward requests from a sub domain to the closed server using the open server. -> open server -> closest server

My understanding is that this can be achieved using Apache's mod proxy but I'm having difficulty setting it up. I'm able to request the home page but all other pages produce a DNS lookup failure error.


<VirtualHost *:80> ServerName ProxyPass / ProxyPassReverse / ProxyPassMatch ^/(.*)$$1i </VirtualHost>

share|improve this question
up vote 2 down vote accepted

Garreth is almost correct but you have to do the opposite:

<VirtualHost *:80>
RewriteEngine On
ProxyPreserveHost On
RewriteRule ^/(.*)$$1 [P,QSA,L]

This way the server at will receive the original "Host: " Header ( aka: , not ) and since the server at might be creating links based on this header this will probably solve your problem.

My guess is that the error you have is not a dns error but a network error, because with your setup the server generates urls looking like: and these urls are not reachable from the internet ( because is a private network behind your vpn ).

With ProxyPreserveHost On your server will generate links to:

share|improve this answer
That did it, thanks! – ScreamingPlastic Mar 26 '14 at 20:11

In this scenario, its easier to use the proxy function [P] in mod_rewrite

<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/(.*)$$1 [P,QSA,L]

You should also be aware of the ProxyPreserveHost Directive

ProxyPreserveHost On|Off

If you have this set to on on your Proxy, it will pass the hostname you are looking for through to mod_proxy, and if mod_proxy can't resolve that, it will give you a DNS error.

share|improve this answer
In you're example, is it routing the request through the first server or just kicking the request over to the seconds? Using ProxyPass I'm able to bring up the home page but any other page results in the DNS error mentioned above. – ScreamingPlastic Mar 25 '14 at 14:11
It is "proxying" the request. – Garreth McDaid Mar 25 '14 at 17:19
Seems to be but it looks like it's only matching on the slash (index page). So I'm not sure if it's my ProxyPassMatch or something else. – ScreamingPlastic Mar 25 '14 at 18:35
ProxyPreserveHost will not resolve anything. You have to set it on if you want to send the destination server the original Host: http header ( instead of: "" ) – Olivier S Mar 26 '14 at 19:46

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.