[GH-ISSUE #1777] Wrong target host is used although raw HTTP request shows the right target host #1771

Open
opened 2026-03-03 19:54:15 +03:00 by kerem · 12 comments
Owner

Originally created by @ChristianWeyer on GitHub (Sep 21, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1777

Originally assigned to: @NghiaTranUIT on GitHub.

Description

This is really strange.

I am using Proxyman on macOS all the time without any issues.
Now, I have a node.js app that uses axios to talk to OpenAI API and Spotify API.

I get a 403 on a request that should go to Spotify but actually goes to OpenAI, using the token meant for Spotify. Obviously, OpenAI gives me a 403.

image

If I disable proxying for the node.js app, everything works fine.
If I use Charles proxy, everything works fine.

I am lost... ;-)

Environment

  • App version: e.g Proxyman 4.11.0
  • macOS version: Ventura 13.5.2
Originally created by @ChristianWeyer on GitHub (Sep 21, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1777 Originally assigned to: @NghiaTranUIT on GitHub. ## Description This is really strange. I am using Proxyman on macOS all the time without any issues. Now, I have a node.js app that uses axios to talk to OpenAI API and Spotify API. I get a 403 on a request that should go to Spotify but actually goes to OpenAI, using the token meant for Spotify. Obviously, OpenAI gives me a 403. ![image](https://github.com/ProxymanApp/Proxyman/assets/888718/3c700e82-b365-49c6-b87d-20404e56de69) If I disable proxying for the node.js app, everything works fine. If I use Charles proxy, everything works fine. I am lost... ;-) ## Environment - App version: e.g Proxyman 4.11.0 - macOS version: Ventura 13.5.2
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 22, 2023):

@ChristianWeyer do you use any Debugging Tools that modify the Request Header?

By default, Proxyman doesn't change any Request/Response data, each request is a separate tunnel, so it doesn't affect to other requests/responses. It means that the Host: api.spotify.com issue is likely from the client side, not Proxyman.

Can you double-check it on your side?

<!-- gh-comment-id:1730601722 --> @NghiaTranUIT commented on GitHub (Sep 22, 2023): @ChristianWeyer do you use any Debugging Tools that modify the Request Header? By default, Proxyman doesn't change any Request/Response data, each request is a separate tunnel, so it doesn't affect to other requests/responses. It means that the `Host: api.spotify.com` issue is likely from the client side, not Proxyman. Can you double-check it on your side?
Author
Owner

@ChristianWeyer commented on GitHub (Sep 22, 2023):

Hi @NghiaTranUIT - nope, I am going straight from the TypeScript/JS code via Proxyman to the target URLs. It works with other debugging proxy tools. This is why I am so confused...

<!-- gh-comment-id:1730820798 --> @ChristianWeyer commented on GitHub (Sep 22, 2023): Hi @NghiaTranUIT - nope, I am going straight from the TypeScript/JS code via Proxyman to the target URLs. It works with other debugging proxy tools. This is why I am so confused...
Author
Owner

@ChristianWeyer commented on GitHub (Sep 22, 2023):

FYI: this is the code I am using in this case:
https://github.com/microsoft/TypeChat/tree/main/examples/music

<!-- gh-comment-id:1730824788 --> @ChristianWeyer commented on GitHub (Sep 22, 2023): FYI: this is the code I am using in this case: https://github.com/microsoft/TypeChat/tree/main/examples/music
Author
Owner

@ChristianWeyer commented on GitHub (Sep 22, 2023):

E.g., this is a line in the code that seems to fail (according to the screenshot above):
github.com/microsoft/TypeChat@ec3a37c441/examples/music/src/endpoints.ts (L445)

<!-- gh-comment-id:1730844787 --> @ChristianWeyer commented on GitHub (Sep 22, 2023): E.g., this is a line in the code that seems to fail (according to the screenshot above): https://github.com/microsoft/TypeChat/blob/ec3a37c44168ff5d3fef954a62278e205a3bab4f/examples/music/src/endpoints.ts#L445
Author
Owner

@mattruby commented on GitHub (Dec 28, 2023):

I have a similar issue. Different hosts switching.
When I quit proxyman, things work fine. This is very frustrating.

<!-- gh-comment-id:1870807444 --> @mattruby commented on GitHub (Dec 28, 2023): I have a similar issue. Different hosts switching. When I quit proxyman, things work fine. This is very frustrating.
Author
Owner

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

It's odd. Let's me investigate it 👍

<!-- gh-comment-id:1871679407 --> @NghiaTranUIT commented on GitHub (Dec 29, 2023): It's odd. Let's me investigate it 👍
Author
Owner

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

@mattruby do you use any debugging tool that might change the host? (such as Map Remote, Breakpoint or Scripting)

By default, Proxyman doesn't change the host, and Proxyman makes a connection by the Host Header, so I'm not sure why it can happen 🤔

<!-- gh-comment-id:1871738877 --> @NghiaTranUIT commented on GitHub (Dec 29, 2023): @mattruby do you use any debugging tool that might change the host? (such as Map Remote, Breakpoint or Scripting) By default, Proxyman doesn't change the host, and Proxyman makes a connection by the Host Header, so I'm not sure why it can happen 🤔
Author
Owner

@mattruby commented on GitHub (Dec 29, 2023):

I have PIA with a dedicated IP in the mix. It really makes no sense.
I'm happy to hop on a screen share and show you what's happening.
I've tried resetting everything in proxyman.

I'm using axios in a nest.js app. I'm pointing it at the proxy using this: export https_proxy=http://192.168.68.126:9090 http_proxy=http://192.168.68.126:9090

This is the correct endpoint being proxied and called:
CleanShot 2023-12-29 at 10 22 48@2x

For some reason, those introspect calls seem to leak into the cart service:
CleanShot 2023-12-29 at 10 25 36@2x

With export NODE_DEBUG=http,http
I can see that I'm trying to call the correct endpoint:
CleanShot 2023-12-29 at 10 34 58@2x

<!-- gh-comment-id:1872207833 --> @mattruby commented on GitHub (Dec 29, 2023): I have PIA with a dedicated IP in the mix. It really makes no sense. I'm happy to hop on a screen share and show you what's happening. I've tried resetting everything in proxyman. I'm using axios in a nest.js app. I'm pointing it at the proxy using this: `export https_proxy=http://192.168.68.126:9090 http_proxy=http://192.168.68.126:9090` This is the correct endpoint being proxied and called: ![CleanShot 2023-12-29 at 10 22 48@2x](https://github.com/ProxymanApp/Proxyman/assets/142194/9b185019-cbde-4724-bd4d-b7145064df51) For some reason, those introspect calls seem to leak into the cart service: ![CleanShot 2023-12-29 at 10 25 36@2x](https://github.com/ProxymanApp/Proxyman/assets/142194/31d1e66f-1602-493e-ba51-0c42d1d5c213) With `export NODE_DEBUG=http,http` I can see that I'm trying to call the correct endpoint: ![CleanShot 2023-12-29 at 10 34 58@2x](https://github.com/ProxymanApp/Proxyman/assets/142194/1cc4dda3-5c29-4190-9e69-66d2736c9c85)
Author
Owner

@mattruby commented on GitHub (Dec 29, 2023):

Is there a way for me to send you a debug log or anything? I'm happy to do so. ProxyMan has saved me so much time!

<!-- gh-comment-id:1872241356 --> @mattruby commented on GitHub (Dec 29, 2023): Is there a way for me to send you a debug log or anything? I'm happy to do so. ProxyMan has saved me so much time!
Author
Owner

@mattruby commented on GitHub (Feb 19, 2024):

I wonder if axios is the problem? https://github.com/axios/axios/issues/5725 looks like it's worth looking into.

<!-- gh-comment-id:1952998226 --> @mattruby commented on GitHub (Feb 19, 2024): I wonder if axios is the problem? https://github.com/axios/axios/issues/5725 looks like it's worth looking into.
Author
Owner

@mattruby commented on GitHub (Feb 19, 2024):

Here's another interesting axios proxy issue: https://github.com/axios/axios/pull/3159
When I set the env params to what proxyman provides: export https_proxy=http://192.168.68.128:9090 http_proxy=http://192.168.68.128:9090 both entries are http.

<!-- gh-comment-id:1953050006 --> @mattruby commented on GitHub (Feb 19, 2024): Here's another interesting axios proxy issue: https://github.com/axios/axios/pull/3159 When I set the env params to what proxyman provides: `export https_proxy=http://192.168.68.128:9090 http_proxy=http://192.168.68.128:9090` both entries are http.
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 20, 2024):

@mattruby I believe that it's from Axios because there are some people has encountered issue on Axios too.

From what I see on your screenshot, you don't have any debugging tool, so Proxyman won't modify your URL.

<!-- gh-comment-id:1953367950 --> @NghiaTranUIT commented on GitHub (Feb 20, 2024): @mattruby I believe that it's from `Axios` because there are some people has encountered issue on Axios too. From what I see on your screenshot, you don't have any debugging tool, so Proxyman won't modify your URL.
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#1771
No description provided.