M
M
mr_blond972015-09-16 17:02:47
Apache HTTP Server
mr_blond97, 2015-09-16 17:02:47

How to use ProxyPreserveHost in apache?

In Apache for the site mysiteA.com is registered

ProxyPass / mysiteB.com.

Thus, the site page loads the page from mysiteB.com. All links lead to mysiteB.com/... It is necessary to make it so that after proxypass the host address is saved and all links lead to mysiteA.com/... I add the rule to Apache:
ProxyPass / mysiteB.com
ProxyPreserveHost on

This rule does not work. How to set up ProxyPreserveHost?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mr_blond97, 2015-09-17
@mr_blond97

Solution: since both sites are running on the same server, you can make ProxyPass through the localhost.

<VirtualHost 127.0.0.1:80>
        ServerAlias mysiteB.com
        DocumentRoot /var/www/
</VirtualHost>

<VirtualHost>
        ServerName mysiteA.com
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1/
</VirtualHost>

M
mureevms, 2015-09-16
@mureevms

This should be enough for proxying:

ProxyPass / http://mysiteB.com/
ProxyPassReverse / http://mysiteB.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question