Mercurial > hg > nginx
comparison src/http/ngx_http_special_response.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 | 6136a51f9c21 |
comparison
equal
deleted
inserted
replaced
6555:090a78da4f88 | 6556:654d2dae97d3 |
---|---|
205 static char ngx_http_error_416_page[] = | 205 static char ngx_http_error_416_page[] = |
206 "<html>" CRLF | 206 "<html>" CRLF |
207 "<head><title>416 Requested Range Not Satisfiable</title></head>" CRLF | 207 "<head><title>416 Requested Range Not Satisfiable</title></head>" CRLF |
208 "<body bgcolor=\"white\">" CRLF | 208 "<body bgcolor=\"white\">" CRLF |
209 "<center><h1>416 Requested Range Not Satisfiable</h1></center>" CRLF | 209 "<center><h1>416 Requested Range Not Satisfiable</h1></center>" CRLF |
210 ; | |
211 | |
212 | |
213 static char ngx_http_error_421_page[] = | |
214 "<html>" CRLF | |
215 "<head><title>421 Misdirected Request</title></head>" CRLF | |
216 "<body bgcolor=\"white\">" CRLF | |
217 "<center><h1>421 Misdirected Request</h1></center>" CRLF | |
210 ; | 218 ; |
211 | 219 |
212 | 220 |
213 static char ngx_http_error_494_page[] = | 221 static char ngx_http_error_494_page[] = |
214 "<html>" CRLF | 222 "<html>" CRLF |
332 ngx_string(ngx_http_error_412_page), | 340 ngx_string(ngx_http_error_412_page), |
333 ngx_string(ngx_http_error_413_page), | 341 ngx_string(ngx_http_error_413_page), |
334 ngx_string(ngx_http_error_414_page), | 342 ngx_string(ngx_http_error_414_page), |
335 ngx_string(ngx_http_error_415_page), | 343 ngx_string(ngx_http_error_415_page), |
336 ngx_string(ngx_http_error_416_page), | 344 ngx_string(ngx_http_error_416_page), |
337 | 345 ngx_null_string, /* 417 */ |
338 #define NGX_HTTP_LAST_4XX 417 | 346 ngx_null_string, /* 418 */ |
347 ngx_null_string, /* 419 */ | |
348 ngx_null_string, /* 420 */ | |
349 ngx_string(ngx_http_error_421_page), | |
350 | |
351 #define NGX_HTTP_LAST_4XX 422 | |
339 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX) | 352 #define NGX_HTTP_OFF_5XX (NGX_HTTP_LAST_4XX - 400 + NGX_HTTP_OFF_4XX) |
340 | 353 |
341 ngx_string(ngx_http_error_494_page), /* 494, request header too large */ | 354 ngx_string(ngx_http_error_494_page), /* 494, request header too large */ |
342 ngx_string(ngx_http_error_495_page), /* 495, https certificate error */ | 355 ngx_string(ngx_http_error_495_page), /* 495, https certificate error */ |
343 ngx_string(ngx_http_error_496_page), /* 496, https no certificate */ | 356 ngx_string(ngx_http_error_496_page), /* 496, https no certificate */ |