In my previous post, I explained how to block access by using X-Forwarded-For. While this works very well in many cases, there are situations where it doesn't do as good a job.
I had a need to block access to multiple VirtualHost entries to a group of IP addresses, and found that it could be achieved using rewrite rules.
Here is an example:
A range can be defined:
Etc...
--
This code went into a file I named /etc/httpd/conf/block.conf (CentOS specific location)
The file was then included into each and every VirtualHost entry, for example:
Etc...
I had a need to block access to multiple VirtualHost entries to a group of IP addresses, and found that it could be achieved using rewrite rules.
Here is an example:
|
|
|
|
--
This code went into a file I named /etc/httpd/conf/block.conf (CentOS specific location)
The file was then included into each and every VirtualHost entry, for example:
|
|
No comments:
Post a Comment