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

Clean HTTP 1.1 to 2 upgrade headers #484

Closed
NiccoMlt opened this issue Jul 23, 2024 · 0 comments · Fixed by #517
Closed

Clean HTTP 1.1 to 2 upgrade headers #484

NiccoMlt opened this issue Jul 23, 2024 · 0 comments · Fixed by #517

Comments

@NiccoMlt
Copy link
Contributor

NiccoMlt commented Jul 23, 2024

When proxying a request, we currently copy all headers without modification:

req.headers(request.getRequestHeaders().copy()); // client request headers

This approach causes problems when our server, configured with HTTP/1.1, receives a request from a client that supports HTTP/2. For example, consider the following cURL request:

curl --http2 -v http://<Carapace URL>

The HTTP/1.1 request contains the following headers:

Connection: Upgrade, HTTP2-Settings
Upgrade: h2c
HTTP2-Settings: <token68>

Our proxy forwards these headers to the backend server. If the backend server supports HTTP/2, it attempts to upgrade the connection. The proxy then forwards this response to the client, which tries to upgrade its connection with the proxy.

However, since the server part doesn't support HTTP/2 yet, the connection fails with the error "Invalid connection preface presented".

To resolve this issue, we should drop the following headers when copying headers during forwarding:

NiccoMlt added a commit that referenced this issue Dec 2, 2024
we don't want to upgrade to HTTP/2 if Carapace supports it, but the backend doesn't

fixes #484
@NiccoMlt NiccoMlt linked a pull request Dec 2, 2024 that will close this issue
NiccoMlt added a commit that referenced this issue Dec 2, 2024
we don't want to upgrade to HTTP/2 if Carapace supports it, but the backend doesn't

fixes #484
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant