HttpRefererModule

WARNING: this article is obsoleted. Please refer to http://nginx.org/en/docs/ for the latest official documentation.

= Synopsis = This module makes it possible to block access to the site with the incorrect values of line "Referer" in the request header.

Keep in mind that it is easy to spoof this header; therefore, the purpose of using of this module consists not in 100% blocking of these requests, but in the blocking of the mass flow of requests, made from typical browsers. Also, consider that the typical browser does not always provide a "Referer" header, even for correct requests.

Example location /photos/ { valid_referers none blocked www.mydomain.com mydomain.com;

if ($invalid_referer) { return  403; } }

= Directives =

valid_referers


This directive assigns a value of 0 or 1 to the variable  based on the contents of the   header.

You can use this to help reduce deep-linking from outside sites. If  header is not accounted for in the list of , then   will be set to 1 (see example above).

The parameters can be as follows:
 * means the absence of "Referer" header.
 * means masked  header by firewall, for example, "Referer: XXXXXXX".
 * server_names is a list of one or more servers. From version 0.5.33 onwards, * wildcards can be used in the server names.

= References = Original Documentation