problem with apache reverse proxy
hi there, after many trys i hope the list can help me. becuase of security reasons i setup a reverse proxy for multible domains problem is, with the following config i only get the primary domain vhosts on reverse proxy: <VirtualHost *:80> ServerName dummy.domain.de ProxyPass / http://test.domain.lan/ ProxyPreserveHost On CacheDisable / ProxyPassReverse ^/(.*)$ http://test.domain.lan/$1 </VirtualHost> <VirtualHost *:80> ServerName dummy2.domain.de ProxyPass / http://test2.domain.lan/ ProxyPreserveHost On CacheDisable / ProxyPassReverse ^/(.*)$ http://test2.kempten.lan$1 </VirtualHost> /etc/hosts on both servers: 192.168.1.1 test.domain.lan test2.domain.lan vhosts on webserver: <VirtualHost test.domain.lan> User xxx Group xxx ServerAdmin xxx DocumentRoot /srv/www/test/ ServerName test.domain.lan ErrorLog xxx TransferLog xxx ScriptAlias xxx </VirtualHost> <VirtualHost test2.domain.lan> User xxx Group xxx ServerAdmin xxx DocumentRoot /srv/www/test/ ServerName test2.domain.lan ErrorLog xxx TransferLog xxx ScriptAlias xxx </VirtualHost> <VirtualHost www.domain.lan> User xxx Group xxx ServerAdmin xxx DocumentRoot /srv/www/test/ ServerName test.domain.lan ErrorLog xxx TransferLog xxx ScriptAlias xxx </VirtualHost> when i access the pages via test.domain.lan everything ok but when i try it via rev proxy dummy.domain.de i get www.domain.lan page (primary website) and not the from rev proxy requested test.domain.lan well, i can do it with squid too but i have no clue how to configure it for multible domains greetings andy --free your mind, use open source http://www.mono-project.com ASCII ribbon campaign ( ) - against HTML email X & vCards / \
Hi,
ProxyPassReverse ^/(.*)$ http://test2.kempten.lan$1 (here is a / missing, put this is probably only in the example?)
if the backend server uses named virtual hosts as in your case, you must use one of * ProxyPreserveHost Off on the reverse proxy * mod_header with RequestHeader set Host in a <Proxy> block on the reverse proxy * ServerAlias dummy.domain.de , etc. on the backend server Hope this helps. Cheers, Stefan
participants (2)
-
Dörfler Andreas
-
sf@sfritsch.de