You are here

Apache reverse proxy

from: Apache definitive guide (O’Reilly), chapter 9

<VirtualHost 10.10.10.10>
  ServerName www.example.com
  ServerAlias example.com
  RewriteEngine On
  RewriteOptions 'inherit'
  RewriteRule \.(gif|jpg|png|txt|html)$ - [last]
  RewriteRule ^/(.*)$ http://localhost:4077/$1 [proxy]
</VirtualHost>
<VirtualHost 10.10.10.10>
  ServerName foo.example.com
  RewriteEngine On
  RewriteOptions 'inherit'
  RewriteRule \.(gif|jpg|png|txt|html)$ - [last]
  RewriteRule ^/(.*)$ http://localhost:4078/$1 [proxy]
</VirtualHost>

from: www.unix.com/…ple-servers.html

<virtual host 192.168.0.3>
servername www.frontend.com
RewriteEngine On
RewriteOptions 'inherit'
RewriteRule ^/(.*)$ http://192.168.0.4:8001/$1 [proxy]
</virtual host>

from: http://xqzone.marklogic.com/howto/tutorials/2004-09-cisapache.xqy
<Directory "/usr/local/httpd/htdocs">
    Options Indexes
    AllowOverride None
    ...
    RewriteEngine on
    RewriteRule ^(.*xqy)$ http://localhost:8000/$1 [L,P]
    ...
</Directory>

For a simple redirect, all you need is to use webmin and

  • Aliases and Redirects:
    Map local to remote URLs / to 192.168.1.101
    Map remote Location: headers to local: ditto
  • Proxying:
    Preserve original Host: header YES
    (this will set: ProxyPreserveHost On )