[GH-ISSUE #1844] How to "programmatically" set external proxy per request? #1837

Closed
opened 2026-03-03 19:54:49 +03:00 by kerem · 2 comments
Owner

Originally created by @seidnerj on GitHub (Nov 9, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1844

In my scenario - I have a process that has multiple sessions, each using a different (but fixed per session) proxy server. This is fine in general, I simply set the code to use a specific proxy server per session.

I need to see what's happening during the requests done by any given session, for this I use Proxyman. However, now begs the question how do I replicate this same behavior while maintaining the above logic. If I want to use Proxyman, I need to set the proxy server to Proxyman's address, I can also set a specific external proxy, but this isn't enough.

I guess I could use multiple processes of Proxyman, in theory, but I'm not sure if that would work, nor is this a desired experience from a usability standpoint.

Ideally this could provided to Proxyman, per request, by some kind of special header, e.g. "X-Upstream-Proxy" with values such as "http://user:pass@someproxy.com:1312" or "socks5h://user:pass@socksproxy.com:8080".

Is there a way to do something like this currently? if there isn't, is there some kind of workaround that could be implemented to achieve the aforementioned functionality?

Thanks in advance

Originally created by @seidnerj on GitHub (Nov 9, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1844 In my scenario - I have a process that has multiple sessions, each using a different (but fixed per session) proxy server. This is fine in general, I simply set the code to use a specific proxy server per session. I need to see what's happening during the requests done by any given session, for this I use Proxyman. However, now begs the question how do I replicate this same behavior while maintaining the above logic. If I want to use Proxyman, I need to set the proxy server to Proxyman's address, I can also set a specific external proxy, but this isn't enough. I guess I could use multiple processes of Proxyman, in theory, but I'm not sure if that would work, nor is this a desired experience from a usability standpoint. Ideally this could provided to Proxyman, per request, by some kind of special header, e.g. "X-Upstream-Proxy" with values such as "http://user:pass@someproxy.com:1312" or "socks5h://user:pass@socksproxy.com:8080". Is there a way to do something like this currently? if there isn't, is there some kind of workaround that could be implemented to achieve the aforementioned functionality? Thanks in advance
kerem 2026-03-03 19:54:49 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 10, 2023):

Hey @seidnerj unfortunately, this feature (External Proxy per requests) is not available yet.

Proxyman only supports the External Proxy for all requests that go through Proxyman.

I'm not sure how to workaround since macOS allows 1 Proxyman instance at a time. You can't open multiple Proxyman apps.

<!-- gh-comment-id:1804915037 --> @NghiaTranUIT commented on GitHub (Nov 10, 2023): Hey @seidnerj unfortunately, this feature (External Proxy per requests) is not available yet. Proxyman only supports the [External Proxy](https://docs.proxyman.io/advanced-features/external-proxy) for all requests that go through Proxyman. I'm not sure how to workaround since macOS allows 1 Proxyman instance at a time. You can't open multiple Proxyman apps.
Author
Owner

@seidnerj commented on GitHub (Nov 10, 2023):

I found a workaround for this. I wrote a small mitmproxy add-on that routes a request to a specific upstream proxy based on a custom header such as I suggested above. I then set Proxyman to use this special proxy as the "External Proxy" so all the traffic first passes through Proxyman then proceeds to be routed to the desired upstream proxy server.

I posted the solution here:

https://stackoverflow.com/questions/77450814/how-to-dynamically-route-and-authenticate-upstream-proxies-in-mitmproxy-based-on

<!-- gh-comment-id:1806526043 --> @seidnerj commented on GitHub (Nov 10, 2023): I found a workaround for this. I wrote a small mitmproxy add-on that routes a request to a specific upstream proxy based on a custom header such as I suggested above. I then set Proxyman to use this special proxy as the "External Proxy" so all the traffic first passes through Proxyman then proceeds to be routed to the desired upstream proxy server. I posted the solution here: https://stackoverflow.com/questions/77450814/how-to-dynamically-route-and-authenticate-upstream-proxies-in-mitmproxy-based-on
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#1837
No description provided.