comparison src/http/ngx_http_request.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 055cbb52ac1d
children 690b15cc8915
comparison
equal deleted inserted replaced
6555:090a78da4f88 6556:654d2dae97d3
2067 2067
2068 if (sscf->verify) { 2068 if (sscf->verify) {
2069 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 2069 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2070 "client attempted to request the server name " 2070 "client attempted to request the server name "
2071 "different from that one was negotiated"); 2071 "different from that one was negotiated");
2072 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 2072 ngx_http_finalize_request(r, NGX_HTTP_MISDIRECTED_REQUEST);
2073 return NGX_ERROR; 2073 return NGX_ERROR;
2074 } 2074 }
2075 } 2075 }
2076 2076
2077 #endif 2077 #endif