7 February 2018

APACHE - Reverse Proxy using root (/)

This took me days to figure out. I am happy to share with you guys who are wondering how to setup a reverse proxy. 

<VirtualHost *:8081>
       ServerName my-server
       DocumentRoot /var/www/html/my-app
       RewriteEngine On
       <Directory /var/www/html/my-app/>
      Options FollowSymLinks
              AllowOverride All
      Require all granted
       </Directory>
ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://{internal-app-server-ip}/
ProxyPassReverse / http://{internal-app-server-ip}/

</VirtualHost>

Save it and restart apache service.

When you access http://my-server:8081 in a browser apache will interpret the configuration above and redirects the url to http://{internal-app-server-ip}/ - internally while preserving the originating url in your browser which is http://my-server:8081. 

No comments:

APACHE - failed to start

[On] Red Hat Enterprise Linux Server release 7.4 (Maipo) Apache was not running and attempt to start the httpd service failed. The natural t...