- Notifications
You must be signed in to change notification settings - Fork7.7k
Add a HTTP_HOST parameter to default_params.#1031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
pluknet left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The resulting diff looks good.
Please split this change into separate commits, each for its own module.
Although these changes are similar to each other, they do not have nothing that unites them.
Like it was previously done ind8a7c65,54ce381,321ff71 series.
This will also allow to set an appropriate commit log prefix:
Proxy: ...
FastCGI: ...
It is important to mention in the commit log that this change alters
the existing behavior to pass CGI parameters from HTTP request header fields.
In particular, that this replaces existing logic to pass HTTP_HOST from $host.
And describe why we alter this.
Something drafted like this might work:
Proxy: improved HTTP_HOST to match request target host.
Previously this always used the request Host header.
.. then describe why this didn't work for HTTP/2 and HTTP/3 ":authority", also for HTTP/1.x absolute URI...
You could also refer in the commit log to the CGI specification
in RFC 3875, section 4.1.18, to support this change, specifically:
The server SHOULD set meta-variablesspecific to the protocol and
scheme for the request. Interpretation of protocol-specific
variablesdepends on the protocol version in SERVER_PROTOCOL.
(markups are mine)
When using HTTP/2 or prior the CGI/1.1 HTTP_HOST environment variable isset to the requested target host.However with HTTP/3 (or with HTTP/1.1 with the host contained in therequest line) this was not happening.The HTTP/2 module uses the ':authority' pseudo-header field to sethttp_host. It was decided not to do that for HTTP/3.Instead we create a *new* default for http_host which will now use theHOST request header or :authority pseudo-header field.While this is a slight change in behaviour in regards to passing HTTPrequest header fields, it should be fine in practice as the HTTP hostrequest header and the :authority pseudo-header field should be thesame.Also the CGI specification (RFC 3875, 4.1.18) notes The server SHOULD set meta-variables specific to the protocol and scheme for the request. Interpretation of protocol-specific variables depends on the protocol version in SERVER_PROTOCOL.Link: <https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.18>Closes:nginx#455Closes:nginx#912
When using HTTP/2 or prior the CGI/1.1 HTTP_HOST environment variable isset to the requested target host.However with HTTP/3 (or with HTTP/1.1 with the host contained in therequest line) this was not happening.The HTTP/2 module uses the ':authority' pseudo-header field to sethttp_host. It was decided not to do that for HTTP/3.Instead we create a *new* default for http_host which will now use theHOST request header or :authority pseudo-header field.While this is a slight change in behaviour in regards to passing HTTPrequest header fields, it should be fine in practice as the HTTP hostrequest header and the :authority pseudo-header field should be thesame.Also the CGI specification (RFC 3875, 4.1.18) notes The server SHOULD set meta-variables specific to the protocol and scheme for the request. Interpretation of protocol-specific variables depends on the protocol version in SERVER_PROTOCOL.Link: <https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.18>
When using HTTP/2 or prior the CGI/1.1 HTTP_HOST environment variable isset to the requested target host.However with HTTP/3 (or with HTTP/1.1 with the host contained in therequest line) this was not happening.The HTTP/2 module uses the ':authority' pseudo-header field to sethttp_host. It was decided not to do that for HTTP/3.Instead we create a *new* default for http_host which will now use theHOST request header or :authority pseudo-header field.While this is a slight change in behaviour in regards to passing HTTPrequest header fields, it should be fine in practice as the HTTP hostrequest header and the :authority pseudo-header field should be thesame.Also the CGI specification (RFC 3875, 4.1.18) notes The server SHOULD set meta-variables specific to the protocol and scheme for the request. Interpretation of protocol-specific variables depends on the protocol version in SERVER_PROTOCOL.Link: <https://datatracker.ietf.org/doc/html/rfc3875#section-4.1.18>
Uh oh!
There was an error while loading.Please reload this page.
This set of commits adds a new default value for $http_host for the FastCGI, SCGI & uwsgi modules, which will be based on the HTTP HOST request header or :authority pseudo-header field accordingly.