Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
ac000 wants to merge3 commits intonginx:master
base:master
Choose a base branch
Loading
fromac000:http_host

Conversation

@ac000
Copy link
Member

@ac000ac000 commentedDec 12, 2025
edited
Loading

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.

@ac000ac000 marked this pull request as ready for reviewDecember 12, 2025 16:06
@ac000ac000 requested a review frompluknetDecember 12, 2025 16:07
Copy link
Contributor

@pluknetpluknet left a 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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pluknetpluknetAwaiting requested review from pluknet

At least 1 approving review is required to merge this pull request.

Assignees

@ac000ac000

Labels

None yet

Projects

None yet

Milestone

nginx-1.29.5

3 participants

@ac000@pluknet@sindhushiv

[8]ページ先頭

©2009-2025 Movatter.jp