Forum Moderators: phranque

Message Too Old, No Replies

Apache order deny,allow problems

         

Psychopsia

8:03 pm on Aug 25, 2006 (gmt 0)

10+ Year Member



Hi!

I'm trying to block requests from outside our local network, it's a private server, so need to allow only 192.168.3.*

The problem is the server is misconfigured to always send to Apache the IP: 10.0.0.1, even external requests, the htaccess looks like:

This allow access but even is an external pc:

order deny,allow
deny from all
allow from 10.0.0.1

I need this config, but doesn't work because the server config send 10.0.0.1 to apache:

order deny,allow
deny from all
allow from 192.168.3.

Question: Can I do a rewrite rule to do this? like:

Options +FollowSymlinks
rewriteEngine On
rewriteCond %{HTTP_FORWARDED_FOR}!192\.168\.3\..*
rewriterule / - [F]

Thank you!

jdMorgan

3:41 am on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, try HTTP_X_FORWARDED_FOR -- I see that one a lot more often.

If the proxy is configured to forward the requestor's IP, it should be in that variable, or perhaps in HTTP_CLIENT_IP.

Jim