We need to block a specific URL for anyone not on a local IP (anyone without a 192.168.. address)

We however cannot use apache's

<Directory /var/www/foo/bar>
Order allow,deny
Allow from 192.168
</Directory>

<Files /var/www/foo/bar>
Order allow,deny
Allow from 192.168
<Files>

Because these would block specific files or directories, we need to block a specific URL which is created by mod-rewrite and the page is dynamically created using PHP.

Any ideas would be greatly appreciated

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

Probably you still can use

<Location /foo/bar>
Order deny,allow
Deny from all
Allow from 192.168
</Location>
link|improve this answer
Should I be putting the URL before it was modified by mod-rewrite or the one the user sees in their browser? Thanks a lot by the way – Alex Feb 8 '11 at 22:42
I am not 100% sure, but I think you should put an original unmodified URL as it is in the browser. I think these directives are processed prior to invoking mod_rewrite handlers. – Alex Feb 8 '11 at 22:55
feedback

You can do this type of filtering with iptables. This does not work for HTTPS.

iptables -I INPUT -m string --string '/foo/bar' --algo bm -p tcp --dport 80 -j REJECT --reject-with tcp-reset

This is obviously hack style solution, but thats how i roll!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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