1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
=encoding utf-8
=head1 NAME
ngx_http_browser_module - Module ngx_http_browser_module
=head1
The C<ngx_http_browser_module> module creates variables
whose values depend on the value of the C<User-Agent>
request header field:
=over
=item C<$modern_browser>
equals the value set by the L</modern_browser_value> directive,
if a browser was identified as modern;
=item C<$ancient_browser>
equals the value set by the L</ancient_browser_value> directive,
if a browser was identified as ancient;
=item C<$msie>
equals “1” if a browser was identified as MSIE of any version.
=back
=head1 Example Configuration
Choosing an index file:
modern_browser_value "modern.";
modern_browser msie 5.5;
modern_browser gecko 1.0.0;
modern_browser opera 9.0;
modern_browser safari 413;
modern_browser konqueror 3.0;
index index.${modern_browser}html index.html;
Redirection for old browsers:
modern_browser msie 5.0;
modern_browser gecko 0.9.1;
modern_browser opera 8.0;
modern_browser safari 413;
modern_browser konqueror 3.0;
modern_browser unlisted;
ancient_browser Links Lynx netscape4;
if ($ancient_browser) {
rewrite ^ /ancient.html;
}
=head1 Directives
=head2 ancient_browser
B<syntax:> ancient_browser I<I<C<string>> ...>
B<context:> I<http>
B<context:> I<server>
B<context:> I<location>
If any of the specified substrings is found in the C<User-Agent>
request header field, the browser will be considered ancient.
The special string “C<netscape4>” corresponds to the
regular expression “C<^MozillaE<sol>[1-4]>”.
=head2 ancient_browser_value
B<syntax:> ancient_browser_value I<I<C<string>>>
B<default:> I<1>
B<context:> I<http>
B<context:> I<server>
B<context:> I<location>
Sets a value for the C<$ancient_browser> variables.
=head2 modern_browser
B<syntax:> modern_browser I<I<C<browser>> I<C<version>>>
B<syntax:> modern_browser I<C<unlisted>>
B<context:> I<http>
B<context:> I<server>
B<context:> I<location>
Specifies a version starting from which a browser is considered modern.
A browser can be any one of the following: C<msie>,
C<gecko> (browsers based on Mozilla),
C<opera>, C<safari>,
or C<konqueror>.
Versions can be specified in the following formats: X, X.X, X.X.X, or X.X.X.X.
The maximum values for each of the format are
4000, 4000.99, 4000.99.99, and 4000.99.99.99, respectively.
The special value C<unlisted> specifies to consider
a browser as modern if it was not listed by the
C<modern_browser> and L</ancient_browser>
directives.
Otherwise such a browser is considered ancient.
If a request does not provide the C<User-Agent> field
in the header, the browser is treated as not being listed.
=head2 modern_browser_value
B<syntax:> modern_browser_value I<I<C<string>>>
B<default:> I<1>
B<context:> I<http>
B<context:> I<server>
B<context:> I<location>
Sets a value for the C<$modern_browser> variables.
|