Skip to content

Commit

Permalink
Fix missing port in proxy CONNECT when using the default HTTPS port
Browse files Browse the repository at this point in the history
  • Loading branch information
segevfiner committed Oct 30, 2023
1 parent 51b0f66 commit 1f148e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/grpc-js/src/http_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,16 @@ export function getProxiedConnection(
if (parsedTarget === null) {
return Promise.resolve<ProxyConnectionResult>({});
}
const targetHostPost = splitHostPort(parsedTarget.path);
if (targetHostPost === null) {
return Promise.resolve<ProxyConnectionResult>({});
}
const options: http.RequestOptions = {
method: 'CONNECT',
path: parsedTarget.path,
path: targetHostPost.host + ':' + (targetHostPost.port != null ? targetHostPost.port : '443'),
};
const headers: http.OutgoingHttpHeaders = {
Host: parsedTarget.path,
Host: targetHostPost.host + ':' + (targetHostPost.port != null ? targetHostPost.port : '443'),
};
// Connect to the subchannel address as a proxy
if (isTcpSubchannelAddress(address)) {
Expand Down

0 comments on commit 1f148e9

Please sign in to comment.