Skip to content

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: bb32cde

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 ready!

Name Link
🔨 Latest commit bb32cde
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/68a7d3d945bf3a000871a590
😎 Deploy Preview https://deploy-preview-4010--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@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
@ScriptedAlchemy
Copy link
Member

@copilot theres CI errors.

Copy link
Author

Copilot AI commented Aug 21, 2025

@copilot theres CI errors.

Fixed the CI formatting errors. The main issues were trailing whitespace and line wrapping that didn't meet the project's formatting standards. I've run the formatter and updated the lockfile for the new https-proxy-agent dependency. All linting and tests pass locally.

Co-authored-by: ScriptedAlchemy <[email protected]>
- Fix HttpsProxyAgent generic type parameter requirement
- Add mock cleanup to prevent test isolation issues
- Revert unrelated README.md formatting changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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