Skip to content

fix(dts-plugin): Add https-proxy-agent support for HTTP-only corporate proxies #4010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Aug 19, 2025

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 default https.Agent doesn't handle HTTPS requests through HTTP-only proxies - it doesn't send the required CONNECT request for tunneling.

This change adds support for HTTP-only proxies by:

  1. Adding https-proxy-agent dependency (v7.0.5) to handle HTTPS requests through HTTP proxies
  2. Enhancing axiosGet function to detect proxy environment variables and conditionally use HttpsProxyAgent
  3. Maintaining backward compatibility with existing configurations

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 (with proxy: false to disable axios built-in proxy)
  • Standard https.Agent when no proxy is configured

Example of the corporate environment this fixes:

export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080  # Note: http:// protocol for HTTPS proxy

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 the family 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.

Copy link

changeset-bot bot commented Aug 19, 2025

⚠️ No Changeset found

Latest commit: 969b071

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Aug 19, 2025

Deploy Preview for module-federation-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 969b071
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/68a45318b7557100084b8898

@Copilot Copilot AI changed the title [WIP] dts-plugin: axios should use https agent that can tunnel via HTTP-only proxy fix(dts-plugin): Add https-proxy-agent support for HTTP-only corporate proxies Aug 19, 2025
@Copilot Copilot AI requested a review from ScriptedAlchemy August 19, 2025 10:37
Copilot finished work on behalf of ScriptedAlchemy August 19, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dts-plugin: axios should use https agent that can tunnel via HTTP-only proxy
2 participants