Mercurial > hg > nginx-site
view xml/en/docs/http/ngx_http_referer_module.xml @ 659:77a3314c74a7
Avoid the uses of second person.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 28 Aug 2012 09:23:40 +0000 |
parents | 764fbac1b8b4 |
children | 95c3c3bbf1ce |
line wrap: on
line source
<?xml version="1.0"?> <!-- Copyright (C) Igor Sysoev Copyright (C) Nginx, Inc. --> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> <module name="Module ngx_http_referer_module" link="/en/docs/http/ngx_http_referer_module.html" lang="en" rev="1"> <section id="summary"> <para> The <literal>ngx_http_referer_module</literal> module allows to block access to a site for requests with invalid values in the <header>Referer</header> header field. It should be kept in mind that fabricating a request with an appropriate <header>Referer</header> field value is quite easy, and so the intended purpose of this module is not to block such requests thoroughly but to block the mass flow of requests sent by regular browsers. It should also be taken into consideration that regular browsers may not send the <header>Referer</header> field even for valid requests. </para> </section> <section id="example" name="Example Configuration"> <para> <example> valid_referers none blocked server_names *.example.com example.* www.example.org/galleries/ ~\.google\.; if ($invalid_referer) { return 403; } </example> </para> </section> <section id="directives" name="Directives"> <directive name="referer_hash_bucket_size"> <syntax><value>size</value></syntax> <default>64</default> <context>server</context> <context>location</context> <appeared-in>1.0.5</appeared-in> <para> Sets the bucket size for the valid referers hash tables. Details of setting up hash tables are provided in a separate <link doc="../hash.xml">document</link>. </para> </directive> <directive name="referer_hash_max_size"> <syntax><value>size</value></syntax> <default>2048</default> <context>server</context> <context>location</context> <appeared-in>1.0.5</appeared-in> <para> Sets the maximum <value>size</value> of the valid referers hash tables. Details of setting up hash tables are provided in a separate <link doc="../hash.xml">document</link>. </para> </directive> <directive name="valid_referers"> <syntax> <literal>none</literal> | <literal>blocked</literal> | <literal>server_names</literal> | <value>string</value> ...</syntax> <default/> <context>server</context> <context>location</context> <para> Specifies values of the <header>Referer</header> request header field that will cause the embedded variable <var>$invalid_referer</var> to be set to an empty string. Otherwise, the variable will be set to “<literal>1</literal>”. Search for a match is case-insensitive. </para> <para> Parameters can be as follows: <list type="tag"> <tag-name><literal>none</literal></tag-name> <tag-desc> the <header>Referer</header> field is missing in the request header; </tag-desc> <tag-name><literal>blocked</literal></tag-name> <tag-desc> the <header>Referer</header> field is present in the request header, but its value was deleted by a firewall or proxy server; such values are strings that do not start from “<literal>http://</literal>” or “<literal>https://</literal>”; </tag-desc> <tag-name><literal>server_names</literal></tag-name> <tag-desc> the <header>Referer</header> request header field contains one of the server names; </tag-desc> <tag-name>arbitrary string</tag-name> <tag-desc> defines a server name and an optional URI prefix. A server name can have an “<literal>*</literal>” at the beginning or end. When checking, the server’s port in the <header>Referer</header> field is ignored; </tag-desc> <tag-name>regular expression</tag-name> <tag-desc> the first symbol should be a “<literal>~</literal>”. It should be noted that an expression will be matched against the text starting after the “<literal>http://</literal>” or “<literal>https://</literal>”. </tag-desc> </list> </para> <para> Example: <example> valid_referers none blocked server_names *.example.com example.* www.example.org/galleries/ ~\.google\.; </example> </para> </directive> </section> </module>