[GH-ISSUE #1618] Help with automatic and manual setup of proxy with NodeJS #1610

Open
opened 2026-03-03 19:52:53 +03:00 by kerem · 4 comments
Owner

Originally created by @tomkerswill on GitHub (Apr 28, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1618

Originally assigned to: @NghiaTranUIT on GitHub.

Description

I am trying to get ProxyMan to intercept requests from a NodeJS application running in a terminal.

If I write a simple Node application, to make a request, and then use either ProxyMan's automated or manual methods to set up the proxy, and then run the node app, I find that the request shows in Proxyman, but instead of an HTTPS URL, I see an HTTP URL.

So, for example, https://google.com would appear as http://google.com

For sites that redirect from http to https, I see a redirect loop.

Steps to Reproduce

I have written a simple nodejs application to test out the proxy. The code is:

import axios from 'axios'; const response = await axios.get("https://google.com"); console.log(response);

If I run this in the ProxyMan automatic setup terminal, the response looks like it's gone to the http version of the site and not the https version.

If I open a fresh terminal, without automatic setup, I do not see the request in ProxyMan, but the node app does then return the https version of the site, as expected.

Environment

Node 19.6.0
Proxyman 4.7.0
macOS Ventura 13.3.1

Originally created by @tomkerswill on GitHub (Apr 28, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1618 Originally assigned to: @NghiaTranUIT on GitHub. ## Description I am trying to get ProxyMan to intercept requests from a NodeJS application running in a terminal. If I write a simple Node application, to make a request, and then use either ProxyMan's automated or manual methods to set up the proxy, and then run the node app, I find that the request shows in Proxyman, but instead of an HTTPS URL, I see an HTTP URL. So, for example, https://google.com would appear as http://google.com For sites that redirect from http to https, I see a redirect loop. ## Steps to Reproduce I have written a simple nodejs application to test out the proxy. The code is: ` import axios from 'axios'; const response = await axios.get("https://google.com"); console.log(response); ` If I run this in the ProxyMan automatic setup terminal, the response looks like it's gone to the http version of the site and not the https version. If I open a fresh terminal, without automatic setup, I do not see the request in ProxyMan, but the node app does then return the https version of the site, as expected. ## Environment Node 19.6.0 Proxyman 4.7.0 macOS Ventura 13.3.1
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 28, 2023):

Thanks. Let me investigate it 👍

<!-- gh-comment-id:1527458280 --> @NghiaTranUIT commented on GitHub (Apr 28, 2023): Thanks. Let me investigate it 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 28, 2023):

It's odd. Only axios makes HTTP instead of HTTPS.

I tries with fetch or got, it works fine.

CleanShot 2023-04-28 at 19 15 46@2x

Here is the fetch and got sample code:

    const res = await fetch("https://httpbin.org/get?lib=fetch");
    console.log(res);

    const { default: got } = await import("got");
    await got("https://httpbin.org/get?lib=got");

I'm working on the fix now 👍

<!-- gh-comment-id:1527481043 --> @NghiaTranUIT commented on GitHub (Apr 28, 2023): It's odd. Only `axios` makes HTTP instead of HTTPS. I tries with `fetch` or `got`, it works fine. ![CleanShot 2023-04-28 at 19 15 46@2x](https://user-images.githubusercontent.com/5878421/235145162-2a5666ea-e76b-4846-ad4f-0cf1907688c9.jpg) Here is the `fetch` and `got` sample code: ```js const res = await fetch("https://httpbin.org/get?lib=fetch"); console.log(res); const { default: got } = await import("got"); await got("https://httpbin.org/get?lib=got"); ``` I'm working on the fix now 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 29, 2023):

@tomkerswill let's try this beta build: https://download.proxyman.io/beta/Proxyman_4.7.0_Fix_automatic_setup_with_axios_lib.dmg

The HTTPS request from axios has been fixed 👍


The problem is:

  • Axios uses a non-standard to make a Proxy HTTPS Connection to Proxyman (Likely a bug from global-agent).

  • Standard: CONNECT httpbin.org:443 HTTP/1.1

  • axios: GET https://httpbin.org/get HTTP/1.1 -> HTTPS

I've double checked with other tool, like Charles Proxy, and it's correct 👍

<!-- gh-comment-id:1528565327 --> @NghiaTranUIT commented on GitHub (Apr 29, 2023): @tomkerswill let's try this beta build: https://download.proxyman.io/beta/Proxyman_4.7.0_Fix_automatic_setup_with_axios_lib.dmg The HTTPS request from `axios` has been fixed 👍 ------------------ The problem is: - Axios uses a non-standard to make a Proxy HTTPS Connection to Proxyman (Likely a bug from global-agent). - Standard: CONNECT httpbin.org:443 HTTP/1.1 - axios: GET https://httpbin.org/get HTTP/1.1 -> HTTPS I've double checked with other tool, like Charles Proxy, and it's correct 👍
Author
Owner

@Geczy commented on GitHub (Apr 30, 2023):

do you have a link to where this issue was first reported on axios? just for history

great work fixing this by the way!

<!-- gh-comment-id:1529030233 --> @Geczy commented on GitHub (Apr 30, 2023): do you have a link to where this issue was first reported on axios? just for history great work fixing this by the way!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1610
No description provided.