Welcome! Log In Create A New Profile

Advanced

Re: HTTP Referer Module

All files from this thread

File Name File Size   Posted by Date  
localhost-if_eth0-day.png 23.1 KB open | download Jim Ohlstein 07/30/2009 Read message
July 30, 2009 01:42PM
On Thu, Jul 30, 2009 at 01:34:48PM -0400, Jim Ohlstein wrote:

> Igor Sysoev wrote:
> >On Thu, Jul 30, 2009 at 09:47:37AM -0400, Jim Ohlstein wrote:
> >
> >
> >>Hello,
> >>
> >>We just went through a period where someone was seriously leeching
> >>bandwidth. See the attached graph. It started just after midnight and I
> >>noticed it this morning and took care of it.
> >>
> >>We run a proxy on that server and someone was referring requests for
> >>YouTube videos on their site to be served via our proxy.
> >>
> >>What I did was to use a location block to return a nasty jpg to all
> >>requests that match their requests.
> >>
> >>location ~ /part-of-encoded-URL {
> >>rewrite ^(.*)$ /bandwidth-leech.jpg permanent;
> >>}
> >>
> >>You can see the results. The requests went away completely after a short
> >>while.
> >>
> >>I initially tried using the HTTP Referer Module but it seems it is
> >>designed to require a list of valid referrers and others default to
> >>invalid. Given the nature of my app, pretty much all referring sites are
> >>"valid" and I would rather be able to list "invalid_referers", perhaps
> >>in "http" section. Then I could add them to my list as they arose, and
> >>not need a location block for each, in each server. If there's a way to
> >>do this, I missed it in the Wiki and the Russian docs.
> >>
> >
> >server {
> >
> > location /... {
> >
> > if ($http_referer ~ ^http://(bad.site|another.bas.site) {
> > rewrite ^(.*)$ /bandwidth-leech.jpg permanent;
> > }
> >
> > ...
> > }
> >}
> >
> >This is a case when if/rewrite are good.
> >
> I don't think I ever expected to "hear" you say that.
>
> Thank you Igor.

There are two cases when "if" works as everyone may expect:

if (...) {
rewrite ... last|redirect|permanent;
}

and

if (...) {
return ...;
}


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

HTTP Referer Module Attachments

Jim Ohlstein July 30, 2009 09:47AM

Re: HTTP Referer Module

Igor Sysoev July 30, 2009 09:54AM

Re: HTTP Referer Module

Jim Ohlstein July 30, 2009 01:34PM

Re: HTTP Referer Module

Igor Sysoev July 30, 2009 01:42PM

HTTP Referer Module Support Variables? And pcre question...

Resicow August 03, 2009 02:45PM

Re: HTTP Referer Module Support Variables? And pcre question...

Maxim Dounin August 06, 2009 06:25PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready