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

Remove HTTP/2 :status pseudo header if added by downstream HTTP client #3369

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benba
Copy link

@benba benba commented Apr 22, 2024

Fixes gh-3326

N.B: For the order of the filter I don't know what is the rule ?
I took the same value as RemoveContentLengthRequestHeadersFilter since it seemed to be a similar kind of filter (but for response instead of request)


@Override
public HttpHeaders apply(HttpHeaders input, ServerResponse serverResponse) {
if (input.containsKey(":status")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check that it is actually an http2 request, or is the presence of the :status pseudo-header enough?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my tests, if JDK HttpClient is used and that the downstream exchange is done in http2, the :status header will be forwarded upstream not matter the HTTP version.
Only difference is that in http1.1 it will still work, while it will crash in http2.
So from my understanding it's better to always remove it as it should never be part of the real headers anyway.

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

Successfully merging this pull request may close these issues.

[Gateway MVC] ERR_HTTP2_PROTOCOL_ERROR if HTTP/2 enabled
3 participants