'Apache VirtualHost directive ProxyPass
I want to use Apache as a proxy for two different sites hosted on different machines. I am currently running Apache 2.2.15.
What I want to achieve is:
Client --> https://ApacheWebProxyPubIP:443
--> /Url1.php --> http://10.0.0.2/Url1.php
--> /Url2 --> http://10.0.0.3/Url2
I tried using:
VirtualHost default:443
ServerName something.nice.org
ProxyPass /Url1.php http://10.0.0.2/Url1.php
ProxyPassReverse /Url1.php http://10.0.0.2/Url1.php
VirtualHost
VirtualHost *:443
ServerName somethingelse.nice.org
ProxyPass /Url2 http://10.0.0.3/Url2
ProxyPassReverse /Url2 http://10.0.0.3/Url2
VirtualHost *:443
The /Url1.php to http://10.0.0.2/Url1.php works fine but Url2 is not forwarded to 10.0.0.3.
What would be the correct syntax to achieve this?
Thanks!
Solution 1:[1]
Use the
ProxyPreserveHost On
directive. Tells the forwarding server to preserve the host name (which is forwarded by the client).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
