Forum Moderators: phranque
What I would like to do is block these addresses from the server, can this be done at the web server, or is this strictly a firewall rule issue? Can I set up allow/deny on the / location and stop them from attempting this?
Thanks for any imput on this issue.
Welcome to WebmasterWorld [webmasterworld.com]!
At the server level, the typical response would be a 403-Forbidden or maybe a 501-Not Implemented or 400-Bad Request response; You could add mod_access or mod_rewrite directives to block them from accessing your pages/images/etc. and return a 403. But this will not "block them from the server," since these modules are, by definition, "inside" the server. To block them from accessing your server, yes, you'll need to stop them at the firewall.
The basic idea is if you get a request that contains a canonical URL, and the domain in that URL does not match your site's domain(s), then block the request. I've seen these requests come in as
GET /http://www.example.com/page.html
and as
GET http://www.example.com/page.html
(with and without the leading slash), so both cases must be handled.
Note that the test for "not my domain" is needed, since it is allowable to use the first request form shown above, and should be permitted as long as the domain in the URL matches the requested hostname. This is not done often, but setting it up now may help future-proof your implementation.
Jim