[GH-ISSUE #691] Viewing HTTPS requests on Proxyman made through Node #686

Closed
opened 2026-03-03 19:21:00 +03:00 by kerem · 7 comments
Owner

Originally created by @water-a on GitHub (Nov 13, 2020).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/691

Proxyman version? (Ex. Proxyman 1.4.3)

Proxyman 2.12.0

macOS Version? (Ex. mac 10.14)

Mac Big Sur 11.0.1

Steps to reproduce

  1. Run the following script
const axios = require('axios');

axios.defaults.proxy = {
  host: '127.0.0.1',
  port: 9090,
};

axios.get('https://walmart.com/');
  1. View request on Proxyman.

Expected behavior

The request is made, however the site redirects to the https://walmart.com/ and that HTTPS request is never shown on Proxyman. I'm wondering how I would get the HTTPS request to show as well on Proxyman.

The request is returned fine in the node application itself.

Screenshots (optional)

image

Originally created by @water-a on GitHub (Nov 13, 2020). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/691 ### Proxyman version? (Ex. Proxyman 1.4.3) Proxyman 2.12.0 ### macOS Version? (Ex. mac 10.14) Mac Big Sur 11.0.1 ### Steps to reproduce 1. Run the following script ``` const axios = require('axios'); axios.defaults.proxy = { host: '127.0.0.1', port: 9090, }; axios.get('https://walmart.com/'); ``` 2. View request on Proxyman. ### Expected behavior The request is made, however the site redirects to the https://walmart.com/ and that HTTPS request is never shown on Proxyman. I'm wondering how I would get the HTTPS request to show as well on Proxyman. The request is returned fine in the node application itself. ### Screenshots (optional) ![image](https://user-images.githubusercontent.com/38114545/99123550-61d87b00-25ce-11eb-9759-fdcadda3ef72.png)
kerem 2026-03-03 19:21:00 +03:00
  • closed this issue
  • added the
    Done
    label
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 14, 2020):

Hi @water-a, It's correct behavior since Proxyman doesn't follow the redirect link at the moment.

If you use curl to make a request to http://walmart.com, you can see the same result:

➜  node curl -v 'http://walmart.com'
*   Trying 161.170.232.170...
* TCP_NODELAY set
* Connected to walmart.com (161.170.232.170) port 80 (#0)
> GET / HTTP/1.1
> Host: walmart.com
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Accept-Ranges: bytes
< Content-Length: 54
< Content-Type: text/html; charset=utf-8
< Location: https://www.walmart.com/
< Via: HTTP/1.1 odnd
< Date: Sat, 14 Nov 2020 02:30:08 GMT
< Set-Cookie: TS011baee6=01c5a4e2f929f43244d55b9e133acf48291f5b480d184642cab1a92941d8d23b315696f18db55a468c030421b7a1396c0aebf460a1; Path=/
<
<html><head></head><body>Redirecting...</body></html>
* Connection #0 to host walmart.com left intact
* Closing connection 0

from Proxyman

Screen Shot 2020-11-14 at 09 29 32
<!-- gh-comment-id:727124135 --> @NghiaTranUIT commented on GitHub (Nov 14, 2020): Hi @water-a, It's correct behavior since Proxyman doesn't follow the redirect link at the moment. If you use curl to make a request to `http://walmart.com`, you can see the same result: ``` ➜ node curl -v 'http://walmart.com' * Trying 161.170.232.170... * TCP_NODELAY set * Connected to walmart.com (161.170.232.170) port 80 (#0) > GET / HTTP/1.1 > Host: walmart.com > User-Agent: curl/7.64.1 > Accept: */* > < HTTP/1.1 301 Moved Permanently < Accept-Ranges: bytes < Content-Length: 54 < Content-Type: text/html; charset=utf-8 < Location: https://www.walmart.com/ < Via: HTTP/1.1 odnd < Date: Sat, 14 Nov 2020 02:30:08 GMT < Set-Cookie: TS011baee6=01c5a4e2f929f43244d55b9e133acf48291f5b480d184642cab1a92941d8d23b315696f18db55a468c030421b7a1396c0aebf460a1; Path=/ < <html><head></head><body>Redirecting...</body></html> * Connection #0 to host walmart.com left intact * Closing connection 0 ``` from Proxyman <img width="1792" alt="Screen Shot 2020-11-14 at 09 29 32" src="https://user-images.githubusercontent.com/5878421/99137245-0e147300-265c-11eb-98bb-9dad374e61e6.png">
Author
Owner

@water-a commented on GitHub (Nov 14, 2020):

Will there ever be an update to follow redirect links?

<!-- gh-comment-id:727124285 --> @water-a commented on GitHub (Nov 14, 2020): Will there ever be an update to follow redirect links?
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 14, 2020):

I don't think that Proxyman should follow. This responsibility is from the end-users's browser or client app. Proxyman just proxy the data forward and backward from your app -> server

If you try on any browser (e.g Google Chrome), the browser will make a redirect request to https://walmart.com from the Location Header Key. At this time, you can see the redirect request from Proxyman.

From what I see, axios doesn't automatically follow the redirect page (https://stackoverflow.com/questions/59473021/axios-follow-redirect)

<!-- gh-comment-id:727125997 --> @NghiaTranUIT commented on GitHub (Nov 14, 2020): I don't think that Proxyman should follow. This responsibility is from the end-users's browser or client app. Proxyman just proxy the data forward and backward from your app -> server If you try on any browser (e.g Google Chrome), the browser will make a redirect request to `https://walmart.com` from the Location Header Key. At this time, you can see the redirect request from Proxyman. From what I see, axios doesn't automatically follow the redirect page (https://stackoverflow.com/questions/59473021/axios-follow-redirect)
Author
Owner

@water-a commented on GitHub (Nov 14, 2020):

I see.

From what I can see, axios (on backend code at least) does follow the request when it redirects. However it might be an issue with axios might not be using the proxy when fetching the redirect.

Thanks for the quick reply!

<!-- gh-comment-id:727132501 --> @water-a commented on GitHub (Nov 14, 2020): I see. From what I can see, axios (on backend code at least) does follow the request when it redirects. However it might be an issue with axios might not be using the proxy when fetching the redirect. Thanks for the quick reply!
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 14, 2020):

Thank you for opening the ticket. I'm happy to have this discussion 🙌

<!-- gh-comment-id:727132618 --> @NghiaTranUIT commented on GitHub (Nov 14, 2020): Thank you for opening the ticket. I'm happy to have this discussion 🙌
Author
Owner

@water-a commented on GitHub (Nov 14, 2020):

Just for anyone else having this issue:

So it appears that when axios follows the redirect (for Node.js backend use), it doesn't seem to use the proxy configuration given.

I've fixed that issue by using the global-agent package. Here's some sample code:

// Use global-agent to patch native http and https Node.js objects with the proxy
const { bootstrap } = require('global-agent');
process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://127.0.0.1:9090';
process.env.GLOBAL_AGENT_HTTPS_PROXY = 'http://127.0.0.1:9090';
bootstrap();

// Perform the request
const axios = require('axios');
axios.get('http://walmart.com/');

Result:
image

<!-- gh-comment-id:727136096 --> @water-a commented on GitHub (Nov 14, 2020): Just for anyone else having this issue: So it appears that when axios follows the redirect (for Node.js backend use), it doesn't seem to use the proxy configuration given. I've fixed that issue by using the global-agent package. Here's some sample code: ``` // Use global-agent to patch native http and https Node.js objects with the proxy const { bootstrap } = require('global-agent'); process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://127.0.0.1:9090'; process.env.GLOBAL_AGENT_HTTPS_PROXY = 'http://127.0.0.1:9090'; bootstrap(); // Perform the request const axios = require('axios'); axios.get('http://walmart.com/'); ``` Result: ![image](https://user-images.githubusercontent.com/38114545/99138477-c9a6ba00-25fe-11eb-931d-787d1bc9d696.png)
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 14, 2020):

Thanks for the trick 🙌

<!-- gh-comment-id:727138896 --> @NghiaTranUIT commented on GitHub (Nov 14, 2020): Thanks for the trick 🙌
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#686
No description provided.