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

http: keep trailers TE header instead of removing it #32255

Merged
merged 23 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/current.yaml
Expand Up @@ -2,6 +2,10 @@ date: Pending

behavior_changes:
# *Changes that are expected to cause an incompatibility if applicable; deployment changes are likely required*
- area: http
change: |
Force the hop by hop TE header from downstream request headers to "trailers". This change can be temporarily reverted
by setting ``envoy.reloadable_features.sanitize_te`` to false.

minor_behavior_changes:
# *Changes that may cause incompatibilities for some users, but should not for most*
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/conn_manager_utility.cc
Expand Up @@ -93,7 +93,7 @@ ConnectionManagerUtility::MutateRequestHeadersResult ConnectionManagerUtility::m
request_headers.removeConnection();
request_headers.removeUpgrade();
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.sanitize_te")) {
request_headers.removeTE();
request_headers.setTE(Http::Headers::get().TEValues.Trailers);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct either. TE may not have been "trailers" to begin with. Maybe check to see if there's a trailers token and if so replace any non'trailers string with trailers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HTTP/2 and 3 only supports trailers TE headers in theory. I added a condition to do this only if the outgoing request is in gRPC, wdyt?

}
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration/protocol_integration_test.cc
Expand Up @@ -806,7 +806,7 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitization) {
auto upstream_headers =
reinterpret_cast<AutonomousUpstream*>(fake_upstreams_[0].get())->lastRequestHeaders();
EXPECT_TRUE(upstream_headers != nullptr);
EXPECT_EQ("", upstream_headers->getTEValue());
EXPECT_EQ("trailers", upstream_headers->getTEValue());
}

// Regression test for https://github.com/envoyproxy/envoy/issues/10270
Expand Down