Welcome! Log In Create A New Profile

Advanced

Re: Problem with Direct-Linking-Prevention

António P. P. Almeida
August 24, 2011 02:30PM
On 23 Ago 2011 10h00 WEST, tamashii@jeranet.at wrote:

> Hello!
>
> Yesterday I've switched from Apache2 to Nginx - and ran into some
> problems with the rewrite Rules.
>
> I tried to do something like:
>
> SetEnvIf Referer mydomain\.com localreferer
> <FilesMatch \.(rar|zip)$>
> Order deny,allow
> Deny from all
> Allow from env=localreferer
> </FilesMatch>
>
> (Which worked on Apache.)
>
> And I came up with this:
>
> ## Stop Download Hijacking
> location ~* (\.rar|\.zip)$ {
> if ($http_referer !~
> ^(http://www.mydomain.com|http://mydomain.com) ) {
> return 444;
> }
> }

Cf. http://wiki.nginx.org/NginxHttpRefererModule

Try:


## No download hijacking.
location ~* \.(?:rar|zip)$ {

valid_referers none blocked www.mydomain.com mydomain.com {
if ($invalid_referer) {
return 444;
}
}
}

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problem with Direct-Linking-Prevention

Tamashii August 23, 2011 05:02AM

Re: Problem with Direct-Linking-Prevention

Samael August 24, 2011 09:28AM

Re: Problem with Direct-Linking-Prevention

António P. P. Almeida August 24, 2011 02:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 239
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