Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_referer_module.xml @ 486:1bf933a9df8b
- Mentioned that --with-pcre-jit has appeared in 1.1.12, and added
a link to the "pcre_jit" directive.
- Brought the range of supported PCRE library versions up to date.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 11 Apr 2012 03:26:09 +0000 |
parents | bb51d3e17dd0 |
children | 9913f1d51c07 |
rev | line source |
---|---|
357
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 <module name="Module ngx_http_referer_module" |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 link="/en/docs/http/ngx_http_referer_module.html" |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 lang="en"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 <section id="summary"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 <para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 The <literal>ngx_http_referer_module</literal> module allows to block |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 access to a site for requests with invalid values in the |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 <header>Referer</header> header field. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 It should be kept in mind that fabricating a request with an appropriate |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 <header>Referer</header> field value is quite easy, and so the intended |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 purpose of this module is not to block such requests thoroughly but to block |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 the mass flow of requests sent by regular browsers. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 It should also be taken into consideration that regular browsers may |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 not send the <header>Referer</header> field even for valid requests. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 </para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 </section> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 <section id="example" name="Example Configuration"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 <para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 <example> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 valid_referers none blocked server_names |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 *.example.com example.* www.example.info/galleries/ |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 ~\.google\.; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 if ($invalid_referer) { |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 return 403; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 } |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 </example> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 </para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 </section> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 <section id="directives" name="Directives"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 <directive name="valid_referers"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 <syntax> |
364 | 47 <literal>none</literal> | |
48 <literal>blocked</literal> | | |
49 <literal>server_names</literal> | | |
50 <value>string</value> | |
51 ...</syntax> | |
357
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 <default/> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 <context>server</context> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 <context>location</context> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 <para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 Specifies values of the <header>Referer</header> request header field |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 that will cause the embedded variable <var>$invalid_referer</var> to |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 be set to 0. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 </para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 <para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 Parameters can be as follows: |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 <list type="tag"> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
66 <tag-name><literal>none</literal></tag-name> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 <tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 the <header>Referer</header> field is missing in the request header; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 </tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 <tag-name><literal>blocked</literal></tag-name> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 <tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 the <header>Referer</header> field is present in the request header, |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 but its value was deleted by a firewall or proxy server; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 such values are strings that do not start from |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 “<literal>http://</literal>”; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 </tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 <tag-name><literal>server_names</literal></tag-name> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 <tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 the <header>Referer</header> request header field contains |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 one of the server names; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 </tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
85 <tag-name>arbitrary string</tag-name> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 <tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 defines a server name and an optional URI prefix. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 A server name can have an “<literal>*</literal>” at the beginning or end. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 When checking, the server’s port in the <header>Referer</header> field |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 is ignored; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
91 </tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
92 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
93 <tag-name>regular expression</tag-name> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
94 <tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
95 the first symbol should be a “<literal>~</literal>”. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 It should be noted that an expression will be matched against |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
97 the text starting after the “<literal>http://</literal>”. |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 </tag-desc> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
99 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
100 </list> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
101 </para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
102 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 <para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 Example: |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
105 <example> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
106 valid_referers none blocked server_names |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
107 *.example.com example.* www.example.info/galleries/ |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
108 ~\.google\.; |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
109 </example> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
110 </para> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
112 </directive> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
113 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
114 </section> |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
115 |
3d6c27e22625
Translated ngx_http_referer_module into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
116 </module> |