Mercurial > hg > nginx-site
view xml/en/docs/http/ngx_http_referer_module.xml @ 572:17ceffcc7ffb
Brought the ngx_http_map_module documentation up to date.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 05 Jul 2012 13:15:08 +0000 |
parents | 6520338cdf0a |
children | be54c443235a |
line wrap: on
line source
<?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> <module name="Module ngx_http_referer_module" link="/en/docs/http/ngx_http_referer_module.html" lang="en"> <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. For more information, please refer to <link doc="../hash.xml">Setting Up Hashes</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. For more information, please refer to <link doc="../hash.xml">Setting Up Hashes</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>