fix(dts-plugin): Add https-proxy-agent support for HTTP-only corporate proxies #4010
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The dts-plugin was unable to fetch remote MFE TypeScript typings (
@mf-types.zip
and@mf-types.d.ts
files) in corporate environments with HTTP-only proxies. The issue occurred because Node's defaulthttps.Agent
doesn't handle HTTPS requests through HTTP-only proxies - it doesn't send the requiredCONNECT
request for tunneling.This change adds support for HTTP-only proxies by:
HttpsProxyAgent
The implementation detects proxy configuration from environment variables (
HTTP_PROXY
,HTTPS_PROXY
,http_proxy
,https_proxy
) with preference for HTTPS_PROXY over HTTP_PROXY, and automatically switches between:HttpsProxyAgent
when proxy is configured (withproxy: false
to disable axios built-in proxy)https.Agent
when no proxy is configuredExample of the corporate environment this fixes:
The solution follows the exact approach suggested in the issue using
https-proxy-agent
and includes comprehensive test coverage for all proxy scenarios while preserving existing functionality like thefamily
parameter for IPv4/IPv6 selection.Fixes #3981.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.io
If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.