Forum Moderators: phranque
This is hammering my bandwidth, so I wonder what I can do about it. The abusive (to my mind) requests come from many different IP ranges, so ban by IP is not a solution. "Download Master" was the user-agent from which I first noticed this happening, so that and other agents are banned in the download directory's ht-access. However, it still happens from apparently innocent user agents.
Recently one connection was served a 403 for being "Download Master", and then changed its user agent to an apparently normal browser and went off on a multiple-request spree again. Is this a sign of some kind of attack? And if so what can I do about it?
I considered disabling KeepAlive but that would be sitewide, right? You can't turn it off on a per-directory basis?
Any advice would be very welcome. Thanks.
PS - installing mod_bw or mod_limitipconn is not an option with my current hosting.
The download will have already started, so the .htaccess will not reapply. You are streaming the file directly from a file, so you've dropped the additional scripting overhead. Run a periodic function to purge old IPs.
This would limit all client downloads of that PDF file to one per second.
I can't think of anything else at the moment if the standard 'bandwidth limiters' are not an option, and you're seeing both IP and user-agent switching from these clients.
You can turn off keep-alive on a per-directory/per-file basis in .htaccess if you like. Here's an example from one of my servers:
# Disconnect client after 403 response
<FilesMatch "^custom-403\.html$">
SetEnv nokeepalive
</FilesMatch>
Jim
In the mean time, is it possible that serving the bots or whatever they are a custom 404 instead of a 403 might confuse them and make them give up? Or is fiddling with the htaccess by itself basically not going to be sufficient for this problem?
EDIT: jpmorgan, thanks for your response as well. Perhaps more hopeful. There's only one file in my download directory so that could work, and I wouldn't need the files container. Is there a substantive difference between writing "SetEnv nokeepalive" and "KeepAlive Off"?
EDIT2: Ah, does setenv restrict it to that directory as I want?
Thanks!