Apache Proxy

To proxy requests in Apache

<VirtualHost *:80>
ServerName youdomain.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://localhost:9292/"
ProxyPassReverse "/" "http://localhost:9292/"
</VirtualHost>​

The ProxyPreserveHost directive in Apache’s configuration is used in the context of a reverse proxy setup. When this directive is set to On, it tells Apache to pass the original Host header from the client request to the proxied server

ProxyRequests Off â€“ This directive turns off forward proxying. In forward proxying, the proxy server forwards client requests to the internet. By setting ProxyRequests Off, you are ensuring that Apache only acts as a reverse proxy, not a forward proxy.

Advertisement

To proxy on cpanel server, use

mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/USERNAME/DOMAIN.EXTN/
vi /etc/apache2/conf.d/userdata/ssl/2_4/USERNAME/DOMAIN.EXTN/proxy.conf

Add the following to the proxy.conf, change ports as needed

ProxyPreserveHost On
ProxyPass "/" "http://localhost:9292/"
ProxyPassReverse "/" "http://localhost:9292/"

Rebuild Apache config

/scripts/rebuildhttpdconf
service httpd restart
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement