You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configuring the HttpClientHandler (& Client Certs) #137
What should we add or change to make your life better?
The application needs to be able to configure attributes on the outbound HttpClient / SocketHttpHandler / HttpClientHandler per backend and/or backend endpoint, especially client certificates.
Client certificates for backend endpoints should be configurable in the config file as well as in code.
Note we've now had two partners need to customize server cert validation because of self-signed certs. The workaround at the moment is to replace the entire ProxyHttpClientFactory in DI.
Need to be able to tweak the handler on a per cluster basis.
Need to consider the association between httpClient and clusters/destinations. Are httpclient instances created on a per cluster basis. What happens if destinations are used in multiple clusters.
Island gateway explicitly does not want a destination in multiple clusters to share connections or HttpClient instances. They want to limit the impact different clients/routes can have on each other.
Change from calling CreateClient per request to only calling it when cluster config changes. Snapshot the client instance on the the ClusterConfig. Capture it at the start of the request pipeline with the rest of the snapshots.
ClusterConfig gets new proxy client options ProxyHttpClientOptions:
SSL validation options
Client certificates
Extensible config / metadata
CreateClient takes the new ProxyHttpClientOptions.
IProxyHttpClientFactory probably moves from ClusterInfo to ReverseProxyConfigManager where ClusterConfigs are created.
Unresolved:
What sugar should we have in Startup to help define these?
AddProxyClient(clusterDetails => new SocketsHttpHandler() => { })?
AddProxyClient((cluserDetails, socketHttpHandler) => {}) with pre-configured defaults?
What guidance should we give people writing factories?
Don't use HttpClient, use HttpMessageInvoker, less overhead.
You could adapt in IHttpClientFactory here, but it would always return you an HttpClient.
Disable things we do in the default factory unless you really need them
Hit an issue today where the underlying service returned a 301 with a relative URL and it attempted to find it on the YARP host instead of the route cluster. Presumably if we could set AllowAutoRedirect to true this would have worked.
Hit an issue today where the underlying service returned a 301 with a relative URL and it attempted to find it on the YARP host instead of the route cluster. Presumably if we could set AllowAutoRedirect to true this would have worked.
Proxies should not follow redirects, the client needs to see those. The redirect should be generated or rewritten using publicly accessible urls, relative or absolute. Please open a separate issue if you want to discuss rewriting.
Activity
Tratcher commentedon May 5, 2020
#113
Tratcher commentedon May 26, 2020
Note we've now had two partners need to customize server cert validation because of self-signed certs. The workaround at the moment is to replace the entire ProxyHttpClientFactory in DI.
Tratcher commentedon Jun 18, 2020
Consolidated from #253
Requirements:
SocketsHttpHandler.SslClientAuthenticationOptions.RemoteCertificateValidationCallbackper backendSignalsWhy is this important to you?
Compliance requirement. YARP isn't an option for us without this.
Tratcher commentedon Jul 2, 2020
Also: The ability to add a DelegatingHandler for advanced customization. #283
samsp-msft commentedon Jul 9, 2020
Need to be able to tweak the handler on a per cluster basis.
Need to consider the association between httpClient and clusters/destinations. Are httpclient instances created on a per cluster basis. What happens if destinations are used in multiple clusters.
Tratcher commentedon Jul 10, 2020
Island gateway explicitly does not want a destination in multiple clusters to share connections or HttpClient instances. They want to limit the impact different clients/routes can have on each other.
This is the current behavior.
Tratcher commentedon Jul 14, 2020
Implementation notes:
IProxyHttpClientFactory is split into two APIs, CreateNormalClient() and CreateUpgradableClient(). The only difference is this additional line in the upgrade client:
https://github.com/microsoft/reverse-proxy/blob/24c0c5a969bb025dd7a355f0b62ee4cbac96c99f/src/ReverseProxy/Service/Proxy/Infrastructure/ProxyHttpClientFactory.cs#L63
@stephentoub confirmed that this is only an optimization used by the ClientWebSocket implementation because it knows none of its connections will ever be pooled. We don't need it in YARP.
Proposal: Consolidate to a single
CreateClient()API.Also, we should make these IProxyHttpClientFactory APIs public soon to unblock people, even if they're not the final APIs we want.
Remove CreateUpgradableClient from the client factory #137
Remove CreateUpgradableClient from the client factory #137 (#332)
Tratcher commentedon Jul 21, 2020
Design proposals:
ProxyHttpClientOptions:Unresolved:
What sugar should we have in Startup to help define these?
What guidance should we give people writing factories?
amweiss commentedon Aug 19, 2020
Hit an issue today where the underlying service returned a 301 with a relative URL and it attempted to find it on the YARP host instead of the route cluster. Presumably if we could set
AllowAutoRedirecttotruethis would have worked.Tratcher commentedon Aug 19, 2020
Proxies should not follow redirects, the client needs to see those. The redirect should be generated or rewritten using publicly accessible urls, relative or absolute. Please open a separate issue if you want to discuss rewriting.