ProxymanApp / proxyman-windows-linux

Public tracker for Proxyman Windows/Linux
https://proxyman.io/
MIT License
100 stars 4 forks source link

Support External Proxy #390

Open NghiaTranUIT opened 6 months ago

NghiaTranUIT commented 6 months ago

Description

Some users report that they are using their corporated Proxy Server to access the Internet. They need the External Proxy Tools from macOS to work on Windows.

See how it works on macOS:

Requirement for the External Proxy

UI

Screenshot 2024-03-20 at 8 50 41 AM Screenshot 2024-03-20 at 8 51 06 AM Screenshot 2024-03-20 at 8 50 49 AM

How External Proxy Works

  1. On Proxyman -> Tools -> Proxy Setting -> External Proxy Settings

    • Enable External proxy checkbox
    • Tick on HTTP/HTTPS
    • Set 127.0.0.1 at port 8080 (Charles Proxy is a External Proxy Server)
  2. Make a cURL to port 9090 (Proxyman). Here is how it works:

5.1. cURL sent a HTTP Request to Proxyman 5.2. Proxyman detects that External Proxy Service is ON 5.3. Proxyman sent CONNECT Request

CONNECT 127.0.0.1:8080 HTTP/1.1
Host: 127.0.0.1:8080
Connection: keep-alive
Proxy-Authorization: basic <username_password_base64> (If the Required Authentication is checked): Read at https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT

5.4. Charles receives a new CONNECT and then response:

HTTP/1.1 200 Connection Established

5.5 Proxyman reads this Response from Charles Proxy and starts a tunnel to Charles Proxy 5.6 When the Tunnel is ready, here is how it looks

Logic: External Proxy Setting

NghiaTranUIT commented 6 months ago

Will add more details requirement for the External Proxy, Bypass Proxy, Include List and the Unit Test soon 👍

NghiaTranUIT commented 6 months ago

External Proxy Service Requirement

https://github.com/ProxymanApp/proxyman-windows-linux/assets/5878421/5f0cddb3-dba9-41e8-a0d4-a2d920be7df9

Screenshot 2024-03-21 at 09 02 23

How to test External Proxy manually

  1. Start Charles Proxy at port 8080
  2. Start Proxyman at 9090
  3. Prepare External Proxy -> HTTP and HTTPS with host = 127.0.0.1, and port = 8080
  4. Clear the Bypass Proxy and Include List
  5. Set bypass localhost is unchecked

⚠️ Important Logic

NghiaTranUIT commented 6 months ago

Bypass Proxy Requirement

For example: 127.0.0.1, localhost,data.com,proxyman,io, api.proxyman.com will parse to

127.0.0.1
localhost
data.com
proxyman.io
api.proxyman.io

-> Seperated by the , and trim the whitespace + newline of each entry (Leading & Trailing position)

How to test Bypass Proxy manually

  1. Start Charles Proxy at port 8080
  2. Start Proxyman at 9090
  3. Prepare External Proxy -> HTTP and HTTPS with host = 127.0.0.1, and port = 8080
  4. Add bypass proxy = httpbin.proxyman.app:443, www.google.com
  5. Set bypass localhost is unchecked

How to test "Bypass Localhost" manually

  1. Start Charles Proxy at port 8080
  2. Start Proxyman at 9090
  3. Prepare External Proxy -> HTTP and HTTPS with host = 127.0.0.1, and port = 8080
  4. Add bypass proxy = httpbin.proxyman.app:443, www.google.com
  5. Set bypass localhost is checked ✅
NghiaTranUIT commented 6 months ago

Include List Proxy Requirement

How to test Include List manually

  1. Start Charles Proxy at port 8080
  2. Start Proxyman at 9090
  3. Prepare External Proxy -> HTTP and HTTPS with host = 127.0.0.1, and port = 8080
  4. Add Include List = *.app
  5. Remove the bypass proxy list
  6. Set bypass localhost is unchecked

NghiaTranUIT commented 6 months ago

Unit Tests

Example:

1. Start Proxyman Server by code
2. Start a local proxy server (can be found on NPM)
3. Set External Proxy to this local proxy server
4. Send a Request by code
5. Verify the `flowPool` of the ProxyCore and the List of passed requests on the Local Server -> Confirm it's passed or not.
6. Repeat with all `cURL`
NghiaTranUIT commented 6 months ago

How to test with External Proxy v2

  1. Start Charles Proxy at port 8080 -> Install the certificate -> Verify we can see HTTPS Response with this app
  2. Open Proxyman at port 9090 -> Set External Proxy for both HTTP and HTTPS to 127.0.0.1 at 8080
  3. Open Google Chrome -> Visit any website, youtube, ...
  4. ✅ Verify we can access these websites as usual, not errors
  5. ✅ Verify we see the request/response (header, body) by enabling the SSL Proxying on some domains -> Can see it on Proxyman and Charles -> There are no errors in 2 apps.
  6. Try using Map Local, Breakpoint on Proxyman -> Verify it's working.