comparison xml/en/docs/http/server_names.xml @ 2767:c56adb7148a4

Described more details about server selection. In particular, this covers how the large_client_header_buffers (ticket #1523) and underscores_in_headers (ticket #1987) directives work in virtual servers.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 13 Jul 2021 13:44:05 +0100
parents 30e2bd353998
children 3b5594157fab
comparison
equal deleted inserted replaced
2766:167329042128 2767:c56adb7148a4
6 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> 6 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
7 7
8 <article name="Server names" 8 <article name="Server names"
9 link="/en/docs/http/server_names.html" 9 link="/en/docs/http/server_names.html"
10 lang="en" 10 lang="en"
11 rev="3" 11 rev="4"
12 author="Igor Sysoev" 12 author="Igor Sysoev"
13 editor="Brian Mercer"> 13 editor="Brian Mercer">
14 14
15 15
16 <section> 16 <section>
335 </para> 335 </para>
336 336
337 </section> 337 </section>
338 338
339 339
340 <section id="virtual_server_selection"
341 name="Virtual server selection">
342
343 <para>
344 First, a connection is created in a default server context.
345 Then, the server name can be determined
346 in the following request processing stages,
347 each involved in server configuration selection:
348
349 <list type="bullet">
350
351 <listitem>
352 <para>
353 during SSL handshake, in advance, according to
354 <link doc="configuring_https_servers.xml" id="sni">SNI</link>
355 </para>
356 </listitem>
357
358 <listitem>
359 <para>
360 after processing the request line
361 </para>
362 </listitem>
363
364 <listitem>
365 <para>
366 after processing the <literal>Host</literal> header field
367 </para>
368 </listitem>
369
370 <listitem>
371 <para>
372 if the server name was not determined after processing the request line or
373 from the <literal>Host</literal> header field,
374 nginx will use the empty name as the server name.
375 </para>
376 </listitem>
377
378 </list>
379
380 At each of these stages, different server configurations can be applied.
381 As such, certain directives should be specified with caution:
382 <list type="bullet">
383
384 <listitem>
385 in case of the
386 <link doc="ngx_http_ssl_module.xml" id="ssl_protocols"/> directive,
387 the protocol list is set by the OpenSSL library before
388 the server configuration could be applied according to the name
389 requested through SNI,
390 thus, protocols should be specified only for a default server;
391 </listitem>
392
393 <listitem>
394 the
395 <link doc="ngx_http_core_module.xml" id="client_header_buffer_size"/>
396 and
397 <link doc="ngx_http_core_module.xml" id="merge_slashes"/> directives
398 are involved before reading the request line,
399 thus, such directives use a default server configuration or
400 the server configuration chosen by SNI;
401 </listitem>
402
403 <listitem>
404 in case of the
405 <link doc="ngx_http_core_module.xml" id="ignore_invalid_headers"/>,
406 <link doc="ngx_http_core_module.xml" id="large_client_header_buffers"/>,
407 and
408 <link doc="ngx_http_core_module.xml" id="underscores_in_headers"/> directives
409 involved in processing request header fields,
410 it additionally depends
411 whether the server configuration was updated
412 according to the request line or the <literal>Host</literal> header field;
413 </listitem>
414
415 <listitem>
416 an error response will be handled with
417 the <link doc="ngx_http_core_module.xml" id="error_page"/> directive
418 in the server that currently fulfills the request.
419 </listitem>
420
421 </list>
422 </para>
423
424 </section>
425
426
340 <section id="optimization" 427 <section id="optimization"
341 name="Optimization"> 428 name="Optimization">
342 429
343 <para> 430 <para>
344 Exact names, wildcard names starting with an asterisk, 431 Exact names, wildcard names starting with an asterisk,