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

I am running CentOS 5.5 with the stock Apache httpd-2.2.3.

I want to set up a proxy server which will forward proxy requests from a single IP address (123.123.123.123 in the example below) and reject requests from all other addresses.

The problem is that apache is proxying all requests through port 81 (rather than just those from 123.123.123.123 and denying all other traffic).

My configuration file is as follows:

Listen 81
<VirtualHost *:81>
  ServerName my.server.com
  ProxyRequests On
  ProxyVia On
  <Proxy *:81>
    Order Deny,Allow
    Deny from all
    Allow from 123.123.123.123
  </Proxy>
  ErrorLog /var/log/httpd/proxy-error.log
  TransferLog /var/log/httpd/proxy-transfer.log
  LogLevel debug
</VirtualHost>

This is the only configuration file with any reference to port 81. No forward proxying is allowed for traffic on port 80 (it serves a website). I am definitely not at IP address 123.123.123.123 when making these requests via curl/Firefox proxy to test.

Commenting out the "Allow from 123.123.123.123" makes no difference - at this point it should simply deny all traffic to port 81.

Can anyone tell me how to fix the above configuration file to provide the requested behavior?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The match string for the <Proxy> block is for the resource being requested, not the server's listener.

Try <Proxy *> instead of <Proxy *:81>.

share|improve this answer
    
Perfect. It works now. Thanks. –  user177660 May 18 '12 at 20:46

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.