HOW TO : Restrict access to proxied content in Apache

If you are using the mod_proxy feature in Apache to forward requests for certain content to a backend server, but want to restrict access to that content to clients originating from certain IP addresses, you can use the location feature in Apache.

The Location directive limits the scope of the enclosed directives by URL. This is very similar to the Directory directive, but the difference is that you can put controls based on the URL rather than the location of the content.

In this example, I am forwarding content destined to to an internal server at I am going to use the Location directive to restrict access to just requests originating from IP Address


<Location /testLocation>
Order Deny,Allow
Deny from all
Allow from

ProxyPass /testLocation
ProxyPassReverse /testLocation [/code]