Mercurial > hg > nginx
comparison src/http/ngx_http_header_filter_module.c @ 6556:654d2dae97d3
HTTP/2: the "421 Misdirected Request" response (closes #848).
Since 4fbef397c753 nginx rejects with the 400 error any attempts of
requesting different host over the same connection, if the relevant
virtual server requires verification of a client certificate.
While requesting hosts other than negotiated isn't something legal
in HTTP/1.x, the HTTP/2 specification explicitly permits such requests
for connection reuse and has introduced a special response code 421.
According to RFC 7540 Section 9.1.2 this code can be sent by a server
that is not configured to produce responses for the combination of
scheme and authority that are included in the request URI. And the
client may retry the request over a different connection.
Now this code is used for requests that aren't authorized in current
connection. After receiving the 421 response a client will be able
to open a new connection, provide the required certificate and retry
the request.
Unfortunately, not all clients currently are able to handle it well.
Notably Chrome just shows an error, while at least the latest version
of Firefox retries the request over a new connection.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Fri, 20 May 2016 18:41:17 +0300 |
parents | 155871d773cc |
children | b3b7e33083ac |
comparison
equal
deleted
inserted
replaced
6555:090a78da4f88 | 6556:654d2dae97d3 |
---|---|
93 ngx_string("412 Precondition Failed"), | 93 ngx_string("412 Precondition Failed"), |
94 ngx_string("413 Request Entity Too Large"), | 94 ngx_string("413 Request Entity Too Large"), |
95 ngx_string("414 Request-URI Too Large"), | 95 ngx_string("414 Request-URI Too Large"), |
96 ngx_string("415 Unsupported Media Type"), | 96 ngx_string("415 Unsupported Media Type"), |
97 ngx_string("416 Requested Range Not Satisfiable"), | 97 ngx_string("416 Requested Range Not Satisfiable"), |
98 | 98 ngx_null_string, /* "417 Expectation Failed" */ |
99 /* ngx_null_string, */ /* "417 Expectation Failed" */ | 99 ngx_null_string, /* "418 unused" */ |
100 /* ngx_null_string, */ /* "418 unused" */ | 100 ngx_null_string, /* "419 unused" */ |
101 /* ngx_null_string, */ /* "419 unused" */ | 101 ngx_null_string, /* "420 unused" */ |
102 /* ngx_null_string, */ /* "420 unused" */ | 102 ngx_string("421 Misdirected Request"), |
103 /* ngx_null_string, */ /* "421 unused" */ | 103 |
104 /* ngx_null_string, */ /* "422 Unprocessable Entity" */ | 104 /* ngx_null_string, */ /* "422 Unprocessable Entity" */ |
105 /* ngx_null_string, */ /* "423 Locked" */ | 105 /* ngx_null_string, */ /* "423 Locked" */ |
106 /* ngx_null_string, */ /* "424 Failed Dependency" */ | 106 /* ngx_null_string, */ /* "424 Failed Dependency" */ |
107 | 107 |
108 #define NGX_HTTP_LAST_4XX 417 | 108 #define NGX_HTTP_LAST_4XX 422 |
109 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX) | 109 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX) |
110 | 110 |
111 ngx_string("500 Internal Server Error"), | 111 ngx_string("500 Internal Server Error"), |
112 ngx_string("501 Not Implemented"), | 112 ngx_string("501 Not Implemented"), |
113 ngx_string("502 Bad Gateway"), | 113 ngx_string("502 Bad Gateway"), |
114 ngx_string("503 Service Temporarily Unavailable"), | 114 ngx_string("503 Service Temporarily Unavailable"), |
115 ngx_string("504 Gateway Time-out"), | 115 ngx_string("504 Gateway Time-out"), |
116 | |
117 ngx_null_string, /* "505 HTTP Version Not Supported" */ | 116 ngx_null_string, /* "505 HTTP Version Not Supported" */ |
118 ngx_null_string, /* "506 Variant Also Negotiates" */ | 117 ngx_null_string, /* "506 Variant Also Negotiates" */ |
119 ngx_string("507 Insufficient Storage"), | 118 ngx_string("507 Insufficient Storage"), |
119 | |
120 /* ngx_null_string, */ /* "508 unused" */ | 120 /* ngx_null_string, */ /* "508 unused" */ |
121 /* ngx_null_string, */ /* "509 unused" */ | 121 /* ngx_null_string, */ /* "509 unused" */ |
122 /* ngx_null_string, */ /* "510 Not Extended" */ | 122 /* ngx_null_string, */ /* "510 Not Extended" */ |
123 | 123 |
124 #define NGX_HTTP_LAST_5XX 508 | 124 #define NGX_HTTP_LAST_5XX 508 |