Skip to content

transport_socket(http_11_proxy): add Proxy-Authorization header support - #46675

Open
glennc24 wants to merge 3 commits into
envoyproxy:mainfrom
glennc24:proxy-authorization-header
Open

transport_socket(http_11_proxy): add Proxy-Authorization header support#46675
glennc24 wants to merge 3 commits into
envoyproxy:mainfrom
glennc24:proxy-authorization-header

Conversation

@glennc24

Copy link
Copy Markdown
Contributor

Commit Message: This patch adds support in HTTP/1.1 Proxy for HTTP proxy authorization.
The HTTP/1.1 Proxy looks up the encoded credentials in its host's
typed filter metadata and sends it with the Proxy-Authorization HTTP
header in the CONNECT request to the proxy.

Proxy authorization is still unsupported when filter state metadata is
used.

Additional Description: AI used to write tests
Risk Level: Low
Testing: Unit and integration test added
Docs Changes: No
Release Notes:
Platform Specific Features: No

This patch adds support in HTTP/1.1 Proxy for HTTP proxy authorization.
The HTTP/1.1 Proxy looks up the encoded credentials in its host's
typed filter metadata and sends it with the Proxy-Authorization HTTP
header in the CONNECT request to the proxy.

Proxy authorization is still unsupported when filter state metadata is
used.

Signed-off-by: Glenn Chen <glenn.chen@nutanix.com>
Signed-off-by: Glenn Chen <glenn.chen@nutanix.com>
Signed-off-by: Glenn Chen <glenn.chen@nutanix.com>
@glennc24

Copy link
Copy Markdown
Contributor Author

/coverage

@repokitteh-read-only

Copy link
Copy Markdown

Coverage for this Pull Request will be rendered here:

https://storage.googleapis.com/envoy-cncf-pr/46675/coverage/index.html

For comparison, current coverage on main branch is here:

https://storage.googleapis.com/envoy-cncf-postsubmit/main/coverage/index.html

The coverage results are (re-)rendered each time the CI Envoy/Checks (coverage) job completes.

🐱

Caused by: a #46675 (comment) was created by @glennc24.

see: more, trace.

@tonya11en tonya11en left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution. A few small comments.

Comment on lines +129 to +135
if (authentication.empty()) {
header_buffer_.add(
absl::StrCat("CONNECT ", host->address()->asStringView(), " HTTP/1.1\r\n\r\n"));
} else {
header_buffer_.add(absl::StrCat("CONNECT ", host->address()->asStringView(), " HTTP/1.1\r\n",
"Proxy-Authorization: ", authentication, "\r\n\r\n"));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this nesting is getting out of hand. Can you pull out this and similar string building logic above into a common helper function?

Comment on lines +44 to +48
// Proxy-Authorization header value for HTTP/1.1 proxy transport sockets.
// When present, the value (a google.protobuf.StringValue) is added as a
// "Proxy-Authorization" header in the HTTP/1.1 CONNECT request.
const std::string ENVOY_HTTP11_PROXY_TRANSPORT_SOCKET_AUTH =
"envoy.http11_proxy_transport_socket.proxy_authorization";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please update the documentation with this.

Config::MetadataFilters::get().ENVOY_HTTP11_PROXY_TRANSPORT_SOCKET_AUTH);
if (auth_it != host->metadata()->typed_filter_metadata().end()) {
Protobuf::StringValue auth_value;
if (MessageUtil::unpackTo(auth_it->second, auth_value).ok()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this fails, we should emit some kind of trace log.

@tonya11en tonya11en self-assigned this Aug 13, 2026
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 this pull request may close these issues.

2 participants