Apache httpd web server can be set up as a reverse proxy (or gateway). A reverse proxy server is configured to serve content from another server. The reverse proxy server serves the content as if it were its own, using its own web address. The content from the external server is mapped under the reverse proxy server's address, so visitors are not aware the content originates from another server. Reverse proxy is used to consolidate multiple servers under a single web address, provide access to servers protected by firewalls, load balancing and to provide content caching for slow servers.
- Skill level:
Other People Are Reading
Things you need
- Apache httpd Web Server
- Text Editor
Enable the proxy module in your Apache configuration files. Historically, the module loading is set in httpd.conf. However, your system may have Apache configuration split into multiple files. Documentation is generally found in the httpd.conf file. Look for the "LoadModule" section and uncomment or add this line:
LoadModule proxy_module modules/mod_proxy.so
Locate the web host configuration section for your server in your Apache configuration file(s). If you are using Apache's virtual hosting, you will want add the reverse proxy configuration directives in your site's <VirtualHost...> container.
Turn off forward proxying by adding the following line to the host configuration:
Add the following lines to map a location from the reverse proxy site to an address on the external site. "ProxyPass" performs the proxying. "ProxyPassReverse" rewrites the headers returned to the client so the content is identified as originating with the reverse proxy server not the original server. Replace the "/store" location with the location name you want to use to map the external content. Replace the web server address with your back-end server address.
The location is appended to the reverse proxy site address to create the URL where the external content will be accessed by visitors. So, if your front-end reverse proxy site is "http://yoursite.com", the external content in the example is accessed at the address "http://yoursite.com/store."
Configure location-specific directives for the mapped location as you normally would using the Location container. Following the previous example, add a Location container:
<Location /store> ... configuration directives... </Location>
Reload or restart Apache as you normally do. Open a browser and go to the newly configured address ("http://yoursite.com/store"--the above example) to test the configuration.
Tips and warnings
- HTML containing self-referencing addresses referring to the originating server can cause problems when the server is behind a firewall or part of a load-balancing cluster. The third-party module mod_proxy_html can be installed for Apache and used to rewrite those URLs using the front-end reverse proxy server address. See the Resources section for a link to mod_proxy_html.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for