Modules required and proxying confguration
Required modules for Reverse Proxy to Work : mod_proxy.so and mod_proxy_http.so
mod_proxy is the module that deals with proxying in Apache and mod_proxy_http handles connections with both http and https
Both the modules must be enabled in the config file
Main argument thats required in the httpd.conf file to enable proxying :
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
Scenario
We have a domain called www.example.com and there are URLs called www.example.com/firsturl and www.example.com/secondurl and /firsturl and /secondurl are different applications.
We want the public to requst www.example.com from internet but, URL's /firsturl and /secondurl must be fetched by the proxy server from internal private network hosts (application1 and application2) with private network address.
Write the below two rules in httpd.conf file :
ProxyPass /firsturl/ http://192.168.0.1/
ProxyPassReverse /firsturl/ http://192.168.0.1/
ProxyPass /secondurl/ http://192.168.0.2/
ProxyPassReverse /secondurl/ http://192.168.0.2/
It will fetch data for www.example.com/firsturl from http://192.168.0.1/ and www.example.com/secondurl from http://192.168.0.2/
Directives
Proxypass: This directive asks the apache server to fetch data for /firsturl from http://192.168.0.1/
ProxyPassReverse: This directive rewrites the original URL available to the Internet when the traffic is send back.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.