Deny referrer using map directive

Dewangga dewanggaba at xtremenitro.org
Mon May 4 04:43:10 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello!

I have a map directive like this :

map $http_referer $badboys {
        hostnames;
        default         0;
        "~*hitleap.com" 1;
}

and already defined on server block like this :

server {
.. skip ..
 if ($badboys) {
	return 406;
 }

.. skip ..

}

but, if I tried to access them using given referral, still got HTTP 200.
$ curl -I https://domain.name -L -e hitleap.com | grep 200
  % Total    % Received % Xferd  Average Speed   Time    Time     Time
 Current
                                 Dload  Upload   Total   Spent    Left
 Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:--
- --:--:--     0
HTTP/1.1 200 OK


Is there any additional configuration needed?
Any help will be appreciated :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQEcBAEBAgAGBQJVRvjdAAoJEF1+odKB6YIxqr0IALSocMLPk584ZuGO82IQ8gw6
//GBuFr1nF15ov9fk3wgcae4S9p4InVWGyQ4y6tvgmrHaaiiZQUg9I99E+P9t7x/
cgdobsy7pg0UZGRsEZSVY5EZhELLyucCZ9p+p0gD/m78JeSHvRFSgPze3jfK5xtv
DsGxu0j8Lk/W7lVqO48mVQTsbsv8mIxGPq5YrReNjXNaRW6XrsW78r8KQH4doTp4
+h3Q0ZfHcl3U28+0I+lmWEAga7/2m9cpRMqoqforvvdOHw/CQStCnPMhLa6ASS8s
kXFqa8xkwjfdoLigGBWjd8hQnHjjBOVdhBUMTTu3i+tAU29H6lJgsipIXe4DWgo=
=pYP1
-----END PGP SIGNATURE-----



More information about the nginx mailing list