Take the 2-minute tour ×

My goal is to allow access to an Apache 2.2 forwarding proxy to the IPs of logged-in users only, while denying all other IPs.

In the proxy virtual host, I've successfully included an "allow from" file that gets dynamically rewritten every time a user logs in or out of the site (adding the IP of logged-in users while deleting the IP of logged-out users). However, this requires a graceful restart/reload of Apache to take effect, and I'm looking to improve the performance if I can... because as the user logs in and is transported to the main page, occasionally Apache is right in the middle of the restart and issues a "busy" warning.

I suppose that I could delay the graceful restart of Apache by a second or two to ease the stress on the initial log-in, but if there is a way to avoid the restart altogether, I'd really appreciate knowing about it. Thanks!

share|improve this question

1 Answer 1


Please do not do this. This is not a solution.

Use RewriteMap directive from Apache's mod_rewrite (RewriteModule) to achieve a dynamic file based IP blacklisting/white listing.

RewriteMap ipslist txt:/path/to/whitelist.txt
RewriteCond %{REMOTE_ADDR} ^(.*)$
RewriteRule (.*) - [F]
share|improve this answer
+1 effectively the rewriteMap cache is flushed when the mtime of the file change. –  regilero Jan 13 '11 at 20:07
+1 great answer, but can I replace whitelist.txt with a DB. @Sarwar Erfan –  Networker Jul 22 at 14:44

Your Answer


