block access to proxy

New to mod_rewrite? This is a good place to start.

block access to proxy

Postby Guest » Tue Nov 26, 2002 8:17 pm

Hi,
I am trying to block sites with rewrite module but it don't works. I have this:
RewriteEngine On
# Either use the (plaintext) allow list from goodsites.txt
RewriteMap ProxyAllow txt:/var/www/sitios.txt
# Or, for faster access, convert it to a DBM database:
# RewriteMap ProxyAllow dbm:/var/www/sitios
# Match lowercased hostnames
RewriteMap lowercase int:tolower
# Here we go:
# 1) first lowercase the site name and strip off a :port suffix
RewriteCond ${lowercase:%{HTTP_HOST}} ^([^:]*).*$
# 2) next look it up in the map file.
# "%1" refers to the previous regex.
# If the result is "OK", proxy access is granted.
RewriteCond ${ProxyAllow:%1|DENY} !^OK$ [NC]
# 3) Disallow proxy requests if the site was _not_ tagged "OK":
RewriteRule ^proxy: - [F]

and some sites in sitios.txt but I can visit all sites with proxy.
Guest
 

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 15 guests

cron