]> git.kaiwu.me - nginx.git/commit
HTTP/2: the "421 Misdirected Request" response (closes #848).
authorValentin Bartenev <vbart@nginx.com>
Fri, 20 May 2016 15:41:17 +0000 (18:41 +0300)
committerValentin Bartenev <vbart@nginx.com>
Fri, 20 May 2016 15:41:17 +0000 (18:41 +0300)
commitf7673bb50f758cb421ca3a5186c49292a85d08ae
tree3e9ab99d2a56465105f03775de56edaf28e2448e
parent61fbcd1cad8b2ba3f160c64ed8ddb3f19a11bd9c
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.
src/http/ngx_http_header_filter_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h
src/http/ngx_http_special_response.c