Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite proxied Host header when URI comes in the form of absolut-URI #1870

Closed
dmpetroff opened this issue Apr 20, 2023 · 2 comments · May be fixed by #1955
Closed

Rewrite proxied Host header when URI comes in the form of absolut-URI #1870

dmpetroff opened this issue Apr 20, 2023 · 2 comments · May be fixed by #1955
Assignees
Labels
Milestone

Comments

@dmpetroff
Copy link
Contributor

https://www.rfc-editor.org/rfc/rfc9112.html#section-3.2.2

When a proxy receives a request with an absolute-form of request-target, the proxy MUST ignore the received Host header field (if any) and instead replace it with the host information of the request-target. A proxy that forwards such a request MUST generate a new Host field value based on the received request-target rather than forward the received Host field value.

Currently we only act as origin-server ignoring Host header in presence of absolute-URI

@voodam
Copy link
Contributor

voodam commented Jun 23, 2023

It was decided on meeting that this issue should be done after some another @const-t's issue, so I set him as assignee.

@voodam voodam assigned const-t and unassigned voodam Jun 23, 2023
@const-t const-t linked a pull request Aug 29, 2023 that will close this issue
@krizhanovsky krizhanovsky modified the milestones: 1.x: TBD, 1.0 - GA, 0.8 - Beta Sep 5, 2023
@krizhanovsky krizhanovsky modified the milestones: 0.8 - Beta, 0.9 - LA Jul 4, 2024
@const-t
Copy link
Contributor

const-t commented Dec 12, 2024

When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client MUST send the target URI in "absolute-form" as the request-target.
...
When a proxy receives a request with an absolute-form of request-target, the proxy MUST ignore the received Host header field (if any) and instead replace it with the host information of the request-target. A proxy that forwards such a request MUST generate a new Host field value based on the received request-target rather than forward the received Host field value.

This is a requirement for requests to a forward-proxy, where the client initially plans to send his request through a proxy. In this case, the forward proxy takes the scheme and address from the uri and connects using them, even over HTTP1.0 protocol. We are a reverse proxy and when the client makes a request to us, he initially does not want to proxy his request, he wants to receive a response as from the origin server. And therefore we must behave as the origin server.

@const-t const-t closed this as completed Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants