How reverse proxy works ?
A reverse proxy server routes connection to the internal server, and the client sees the reverse proxy server itself as the origin server.
Example
Apache can be configured to serve URL like, http://www.example.com/webapp to actually get the content from http://192.168.0.10/myapp, which is hosted from an internal network.
This happens transparently and the user initially requesting http://www.example.com/webapp need not to be aware of what happens in the background.
1. Enable proxy modules
Apache require two modules enabled for reverse proxy to work : proxy and proxy_http
Note: proxy module is dependent to proxy_http module
To enable them, run the following command at the terminal :
# sudo a2enmod proxy_http
# sudo a2enmod proxy
2. Configure reverse proxy
Here, we are having a public facing webserver at http://www.example.com to host our internal site of http://192.168.0.10/myapp to be available as http://www.example.com/webapp
Provide the configuration in the file /etc/apache2/sites-enabled/000-default
ProxyRequests Off
ProxyPass /webapp http://192.168.0.10/myapp
ProxyPassReverse /webapp http://192.168.0.10/myapp
3. Restart Apache
For the effect of changes, Apache web server need to be re-started :
# sudo /etc/init.d/apache2 restart
OR
# sudo service httpd restart
No comments:
Post a Comment
Note: only a member of this blog may post a comment.