Skip to content

Conversation

@tonya11en
Copy link
Member

This patch adds an optional config parameter for specifying a default
proxy address to be used by the transport socket if a proxy address is
not found in the filter state metadata. If the parameter is not set,
behavior of the transport socket remains identical to before this patch.

Risk Level: Low. New parameter.
Testing: unit/integration
Docs Changes: config documented
Release Notes: done
Platform Specific Features: n/a

This patch adds an optional config parameter for specifying a default
proxy address to be used by the transport socket if a proxy address is
not found in the filter state metadata. If the parameter is not set,
behavior of the transport socket remains identical to before this patch.

Signed-off-by: Tony Allen <[email protected]>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #42914 was opened by tonya11en.

see: more, trace.

@tonya11en tonya11en requested a review from kyessenov January 8, 2026 22:53
/**
* @return the default Http11ProxyInfo if configured, or nullopt.
*/
virtual absl::optional<TransportSocketOptions::Http11ProxyInfo> http11ProxyInfo() const PURE;
Copy link
Contributor

Choose a reason for hiding this comment

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

OptRef like the above options would probably be better (avoids copy of shared_ptr)


// Proxy address was not found in the metadata. If a default proxy address is set, return that.
const auto* proxy_config =
dynamic_cast<const Network::Http11ProxyConfiguration*>(&socket_factory);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm, wouldn't this break with nested factories (e.g. TLS over HTTP CONNECT)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Something like TLS over HTTP CONNECT would be configured as an http_11_proxy transport socket with a TLS transport socket configured as the inner/wrapped transport, right? The nested factories would have the http_11_proxy TS factory on the outside, so this should still work.

I just checked and the integration test actually uses TLS for the inner transport socket by default, so the inner socket is TLS for the integration test in this patch.

Copy link
Contributor

@kyessenov kyessenov Jan 9, 2026

Choose a reason for hiding this comment

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

I think it can be the other way: CONNECT inside TLS factory (e.g. HBONE thing from Istio). I think it's OK to accept this limitation, but we should make it clear in the docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

There should be an easy way to solve it? The config should be loaded into the factory and pass the default that way.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the xDS representation, the http_11_proxy transport socket is configured with a child, which would be the TLS transport socket. The TLS transport socket does not have a way to configure a child transport socket, so it can't be configured the other way.

I'm not sure how that config maps to the underlying Envoy implementation, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

@markdroth My concern was about the other way, a TLS socket wrapping HTTP/1.1 PROXY. The dynamic cast would find TLS socket and fail in the previous code iteration.

@markdroth since you started looking, can you own the API review? I think Adi has a lot assigned.
@abeyad I also assigned you as the code owner. The code is mostly OK to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I'm saying is that from the xDS perspective, it's not possible to configure a TLS transport socket wrapping an HTTP/1.1 proxy transport socket -- or any other type of transport socket. There is no way to configure a child transport socket of any type in the TLS transport socket.

Yeah, I'm happy to do the API review.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

With the latest patch, shouldn't this be moot? I don't do the cast anymore.

Signed-off-by: Tony Allen <[email protected]>
Signed-off-by: Tony Allen <[email protected]>
Copy link
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Just a couple of quick drive-by comments from an xDS perspective...


// Proxy address was not found in the metadata. If a default proxy address is set, return that.
const auto* proxy_config =
dynamic_cast<const Network::Http11ProxyConfiguration*>(&socket_factory);
Copy link
Contributor

Choose a reason for hiding this comment

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

In the xDS representation, the http_11_proxy transport socket is configured with a child, which would be the TLS transport socket. The TLS transport socket does not have a way to configure a child transport socket, so it can't be configured the other way.

I'm not sure how that config maps to the underlying Envoy implementation, though.

Signed-off-by: Tony Allen <[email protected]>
/**
* @return the default Http11ProxyInfo if configured, or nullopt.
*/
virtual OptRef<const TransportSocketOptions::Http11ProxyInfo> http11ProxyInfo() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

call it defaultHttp11ProxyInfo similar to defaultSNI down below?

@tonya11en
Copy link
Member Author

/retest

@kyessenov kyessenov assigned markdroth and abeyad and unassigned adisuissa Jan 13, 2026
Copy link
Contributor

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

/lgtm api


// Proxy address was not found in the metadata. If a default proxy address is set, return that.
const auto* proxy_config =
dynamic_cast<const Network::Http11ProxyConfiguration*>(&socket_factory);
Copy link
Contributor

Choose a reason for hiding this comment

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

What I'm saying is that from the xDS perspective, it's not possible to configure a TLS transport socket wrapping an HTTP/1.1 proxy transport socket -- or any other type of transport socket. There is no way to configure a child transport socket of any type in the TLS transport socket.

Yeah, I'm happy to do the API review.

@tonya11en
Copy link
Member Author

/retest

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

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

/lgtm api

@tonya11en tonya11en requested a review from kyessenov January 14, 2026 18:32
Network::TransportSocketOptions::Http11ProxyInfo actual_info = proxy_info.value();
if (actual_info.hostname.empty() && host) {
actual_info.hostname = host->hostname().empty() ? host->address()->asStringView()
: absl::StrCat(host->hostname(), ":",
Copy link
Contributor

Choose a reason for hiding this comment

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

port derivation is strange here: it uses endpoint port which doesn't work if it's a gateway (should be stripping :80), and also it defaults to :443 in the alternate case.

@tonya11en
Copy link
Member Author

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only
Copy link

@envoyproxy/senior-maintainers assignee is @ggreenway

🐱

Caused by: a #42914 (comment) was created by @tonya11en.

see: more, trace.

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.

6 participants