Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an Apache reverse proxy that is currently reverse proxying for a few sites. However i am now going to be adding a new site (lets call it newsite.com) that should only be accessible by certain IP's. Is this doable using Apache as a reverse proxy?

I use VirtualHosts for the sites that are being proxyied. I have tried using the Allow/Deny directives in combination with the Location statements. For example:

<VirtualHost *:80>  
Servername newsite.com   
<Location http://newsite.com>
Order Deny,Allow
Deny from all
Allow from x.x.x.x
<IfModule rewrite_module>
 RewriteRule ^/$ http://newsite.internal.com [proxy]

I have also tried configuring allow/deny specicaily for the site in the Proxy directives, for example

<Proxy http://newsite.com/>
  Order deny,allow
  Deny from all
  Allow from x.x.x.x

I still have this definition for the rest of the proxied sites however.

<Proxy *>
  Order deny,allow
  Allow from all

No matter what i do it seems to be accessible from any where. Is this because of the definition for all other proxied sites. Is there an order to which it applies Proxy directives. I have had the newsite one both before and after the * one, and also within the VirtualHost statement.

share|improve this question

1 Answer 1

had a similar problem today; Was related to how the wildcard matching is done, I think it uses the full URL: in my case I had

<Proxy /jira*>
  Order allow,deny
  Deny from all
ProxyPass /jira https://myhost.com

and this did not work. Site was accessible from anywhere. I tried a couple of things and found a working version:

<Proxy *jira*>

So in your case try with

<Proxy http://newsite.com*>

to make sure apache matches that url.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.