[GH-ISSUE #396] [BUG] Map remote websocket support #396

Open
opened 2026-03-03 19:50:21 +03:00 by kerem · 23 comments
Owner

Originally created by @mariusvn on GitHub (Apr 2, 2024).
Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/396

Originally assigned to: @kics223w1 on GitHub.

Description

Does the map remote tool supports websockets on windows ?

Originally created by @mariusvn on GitHub (Apr 2, 2024). Original GitHub issue: https://github.com/ProxymanApp/proxyman-windows-linux/issues/396 Originally assigned to: @kics223w1 on GitHub. ## Description Does the map remote tool supports websockets on windows ?
Author
Owner

@kics223w1 commented on GitHub (Apr 2, 2024):

Yes it does 👍🏻

<!-- gh-comment-id:2031620672 --> @kics223w1 commented on GitHub (Apr 2, 2024): Yes it does 👍🏻
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

jeez that was fast,

is there anthing special to do because i struggle with that.

Proxyman_PGe2BVHx6L

The link is hidden as it is owned by clients

<!-- gh-comment-id:2031627227 --> @mariusvn commented on GitHub (Apr 2, 2024): jeez that was fast, is there anthing special to do because i struggle with that. ![Proxyman_PGe2BVHx6L](https://github.com/ProxymanApp/proxyman-windows-linux/assets/4770874/68c55b64-e0c1-4344-b50c-ea6119689b90) *The link is hidden as it is owned by clients*
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

on the image the websocket ignore the map remote here

<!-- gh-comment-id:2031628096 --> @mariusvn commented on GitHub (Apr 2, 2024): on the image the websocket ignore the map remote here
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

Proxyman_ZrA0U4NcDb

it is still on the original url (yes it is the same url as the blurred part on the previous image)

<!-- gh-comment-id:2031635517 --> @mariusvn commented on GitHub (Apr 2, 2024): ![Proxyman_ZrA0U4NcDb](https://github.com/ProxymanApp/proxyman-windows-linux/assets/4770874/448d0f0d-3eaf-4772-8981-fdd0f89752a7) it is still on the original url (yes it is the same url as the blurred part on the previous image)
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 2, 2024):

@kics223w1 please investigate it. Try to Map Remote from WSS (production) to a local WS.

@mariusvn In the Rule text fields, can you try to remove the wss:// prefix part, it should be my-domain.fr and try again? 🤔

May I also ask what Proxyman Windows version you're using?

<!-- gh-comment-id:2031676201 --> @NghiaTranUIT commented on GitHub (Apr 2, 2024): @kics223w1 please investigate it. Try to Map Remote from WSS (production) to a local WS. @mariusvn In the Rule text fields, can you try to remove the `wss://` prefix part, it should be `my-domain.fr` and try again? 🤔 May I also ask what Proxyman Windows version you're using?
Author
Owner

@kics223w1 commented on GitHub (Apr 2, 2024):

Okay, I'll investigate this issue.

<!-- gh-comment-id:2031714763 --> @kics223w1 commented on GitHub (Apr 2, 2024): Okay, I'll investigate this issue.
Author
Owner

@kics223w1 commented on GitHub (Apr 2, 2024):

on the image the websocket ignore the map remote here

If you would, can you click on the Summary Tab -> expand the Debugging Tool node -> Verify there is the Map Remote information 🤔 .

If there is, it means the MapRemote Tool has failed to map your request.

If there is nothing, it means the request doesn't match the MapRemote Tool. Please delete the rule and right click on
the request in the MainTable to create new rule.

For instance:
image

<!-- gh-comment-id:2031775038 --> @kics223w1 commented on GitHub (Apr 2, 2024): > on the image the websocket ignore the map remote here If you would, can you click on the Summary Tab -> expand the `Debugging Tool` node -> Verify there is the Map Remote information 🤔 . If there is, it means the MapRemote Tool has failed to map your request. If there is nothing, it means the request doesn't match the MapRemote Tool. Please delete the rule and right click on the request in the MainTable to create new rule. For instance: <img width="1759" alt="image" src="https://github.com/ProxymanApp/proxyman-windows-linux/assets/77295189/6c692890-5d4c-45f0-8631-273eefa39923">
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

i'll take a look in a few minutes, thanks for the active support btw

<!-- gh-comment-id:2031833449 --> @mariusvn commented on GitHub (Apr 2, 2024): i'll take a look in a few minutes, thanks for the active support btw
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

So yeah i do have the map remote entry in the debugging tool section

Proxyman_sVAObkUqWH

<!-- gh-comment-id:2031867140 --> @mariusvn commented on GitHub (Apr 2, 2024): So yeah i do have the map remote entry in the debugging tool section ![Proxyman_sVAObkUqWH](https://github.com/ProxymanApp/proxyman-windows-linux/assets/4770874/022e4449-42f3-4f4b-a200-bbc9dee7339a)
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

May I also ask what Proxyman Windows version you're using?

2.13.0

<!-- gh-comment-id:2031869735 --> @mariusvn commented on GitHub (Apr 2, 2024): > May I also ask what Proxyman Windows version you're using? 2.13.0
Author
Owner

@mariusvn commented on GitHub (Apr 2, 2024):

In the Rule text fields, can you try to remove the wss:// prefix part, it should be my-domain.fr and try again? 🤔

same result :/

<!-- gh-comment-id:2031878686 --> @mariusvn commented on GitHub (Apr 2, 2024): > In the Rule text fields, can you try to remove the wss:// prefix part, it should be my-domain.fr and try again? 🤔 same result :/
Author
Owner

@kics223w1 commented on GitHub (Apr 2, 2024):

Okay, I'm fixing this issue 👍🏻

<!-- gh-comment-id:2031973928 --> @kics223w1 commented on GitHub (Apr 2, 2024): Okay, I'm fixing this issue 👍🏻
Author
Owner

@kics223w1 commented on GitHub (Apr 3, 2024):

Found the reason why this issue happened. @mariusvn

When Map Remote Tool started mapping the request, it will parse the origin URL to extract the hostname, port, scheme, etc...

For instance, when I map https://httpbin.proxyman.app/get to https://httpbin.org/get -> The tool will parse the https://httpbin.proxyman.app/get to get those above properties.

If it fails to parse the origin URL, the tool will ignore the request and do nothing.

May I ask, if your URL contains any invalid characters 🤔 (you don't need to provide the full URL)

If you don't mind, can you test your URL with the below code in https://playcode.io/typescript , I'm pretty sure the result will be false.

const isValidURL = (url: string): boolean => {
  try {
    new URL(url);
    return true;
  } catch (e) {
    return false;
  }
};

const yourURL = "https://github.com";

console.log(isValidURL(yourURL));
<!-- gh-comment-id:2035265814 --> @kics223w1 commented on GitHub (Apr 3, 2024): Found the reason why this issue happened. @mariusvn When Map Remote Tool started mapping the request, it will parse the origin URL to extract the hostname, port, scheme, etc... For instance, when I map `https://httpbin.proxyman.app/get` to `https://httpbin.org/get` -> The tool will parse the `https://httpbin.proxyman.app/get` to get those above properties. If it fails to parse the origin URL, the tool will ignore the request and do nothing. May I ask, if your URL contains any invalid characters 🤔 (you don't need to provide the full URL) If you don't mind, can you test your URL with the below code in https://playcode.io/typescript , I'm pretty sure the result will be false. ```ts const isValidURL = (url: string): boolean => { try { new URL(url); return true; } catch (e) { return false; } }; const yourURL = "https://github.com"; console.log(isValidURL(yourURL)); ```
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 4, 2024):

@kics223w1 The URL is likely valid because modern network clients always construct valid URLs.

<!-- gh-comment-id:2037270137 --> @NghiaTranUIT commented on GitHub (Apr 4, 2024): @kics223w1 The URL is likely valid because modern network clients always construct valid URLs.
Author
Owner

@NghiaTranUIT commented on GitHub (Apr 5, 2024):

@mariusvn if you don't mind, please use this Beta build: https://download.proxyman.io/beta/Proxyman+Setup+2.13.0_Fix_Map_Remote_Websocket.exe

and share with me your result 👍

Screenshots

Screenshot 2024-04-05 at 09 31 37

<!-- gh-comment-id:2038945713 --> @NghiaTranUIT commented on GitHub (Apr 5, 2024): @mariusvn if you don't mind, please use this Beta build: https://download.proxyman.io/beta/Proxyman+Setup+2.13.0_Fix_Map_Remote_Websocket.exe and share with me your result 👍 ### Screenshots ![Screenshot 2024-04-05 at 09 31 37](https://github.com/ProxymanApp/proxyman-windows-linux/assets/5878421/a0c39451-134e-4e7b-bff8-53413968f13f)
Author
Owner

@mariusvn commented on GitHub (Apr 5, 2024):

i will try this afternoon 👍

<!-- gh-comment-id:2039314204 --> @mariusvn commented on GitHub (Apr 5, 2024): i will try this afternoon 👍
Author
Owner

@mariusvn commented on GitHub (Apr 5, 2024):

If you don't mind, can you test your URL with the below code in https://playcode.io/typescript , I'm pretty sure the result will be false.

It does returns true.


May I ask, if your URL contains any invalid characters 🤔 (you don't need to provide the full URL)

x are alphabetic characters [a-z]

wss://xxx-xxxxx-xxx.xxxxxx.fr/ng-cli-ws


@mariusvn if you don't mind, please use this Beta build and share with me your result 👍

So I tried even without the wss:// prefix and it did not work.

it detects that the map remote should apply but mark - as note and do not map it.

it does works perfectly for http. In fact, I am using the map remote tool to simulate that my angular dev server is located on another domain, which works perferctly. (yes this is weird but my clients have a weird setup x) )

I noticed the issue when i wanted to make the live reload work.

it looks like its only with other protocols than http.

<!-- gh-comment-id:2039852473 --> @mariusvn commented on GitHub (Apr 5, 2024): > If you don't mind, can you test your URL with the below code in https://playcode.io/typescript , I'm pretty sure the result will be false. It does returns `true`. --- > May I ask, if your URL contains any invalid characters 🤔 (you don't need to provide the full URL) *x are alphabetic characters [a-z]* `wss://xxx-xxxxx-xxx.xxxxxx.fr/ng-cli-ws` --- >@mariusvn if you don't mind, please use this Beta build and share with me your result 👍 So I tried even without the `wss://` prefix and it did not work. it detects that the map remote should apply but mark `-` as note and do not map it. it does works perfectly for http. In fact, I am using the map remote tool to simulate that my angular dev server is located on another domain, which works perferctly. (yes this is weird but my clients have a weird setup x) ) I noticed the issue when i wanted to make the live reload work. it looks like its only with other protocols than `http`.
Author
Owner

@kics223w1 commented on GitHub (Apr 7, 2024):

@mariusvn May I ask, did you enable Allow List, Block List or Network Conditions Tool while working with Map Remote and Websocket 🤔

If you are enabling the Allow List with Map Remote, please turn off the Allow List. There is a bug about Allow List + Map Remote + Websocket.

<!-- gh-comment-id:2041343321 --> @kics223w1 commented on GitHub (Apr 7, 2024): @mariusvn May I ask, did you enable Allow List, Block List or Network Conditions Tool while working with Map Remote and Websocket 🤔 If you are enabling the Allow List with Map Remote, please turn off the Allow List. There is a bug about Allow List + Map Remote + Websocket.
Author
Owner

@mariusvn commented on GitHub (Apr 8, 2024):

Yep that's it !!

Is it possible to add script before or after the map remote step ? because i need to update the origin header to make it work

<!-- gh-comment-id:2042111143 --> @mariusvn commented on GitHub (Apr 8, 2024): Yep that's it !! Is it possible to add script before or after the map remote step ? because i need to update the origin header to make it work
Author
Owner

@kics223w1 commented on GitHub (Apr 8, 2024):

  • @mariusvn Currently, Scripting doesn't support WebSocket yet.

  • May I ask, did you need to set the origin header equal the host in Map Remote Editor to make your WebSocket request work, right 🤔

  • I can refactor the code in Map Remote to do that, no need to use Scripting.

  • P/S: For HTTP and HTTPS, Scripting executes request after Map Remote.

<!-- gh-comment-id:2042213802 --> @kics223w1 commented on GitHub (Apr 8, 2024): - @mariusvn Currently, Scripting doesn't support WebSocket yet. - May I ask, did you need to set the origin header equal the host in Map Remote Editor to make your WebSocket request work, right 🤔 - I can refactor the code in Map Remote to do that, no need to use Scripting. - P/S: For HTTP and HTTPS, Scripting executes request after Map Remote.
Author
Owner

@mariusvn commented on GitHub (Apr 9, 2024):

May I ask, did you need to set the origin header equal the host in Map Remote Editor to make your WebSocket request work, right 🤔

Yes that's exactly that

I can refactor the code in Map Remote to do that, no need to use Scripting.

That would be nice but its not super urgent so no worries if i dont have it real soon

P/S: For HTTP and HTTPS, Scripting executes request after Map Remote.

Noted ! 👍

<!-- gh-comment-id:2044404786 --> @mariusvn commented on GitHub (Apr 9, 2024): > May I ask, did you need to set the origin header equal the host in Map Remote Editor to make your WebSocket request work, right 🤔 Yes that's exactly that > I can refactor the code in Map Remote to do that, no need to use Scripting. That would be nice but its not super urgent so no worries if i dont have it real soon > P/S: For HTTP and HTTPS, Scripting executes request after Map Remote. Noted ! 👍
Author
Owner

@kics223w1 commented on GitHub (Apr 9, 2024):

Yes that's exactly that

Okay, I'll refactor the code 👍🏻

<!-- gh-comment-id:2044408435 --> @kics223w1 commented on GitHub (Apr 9, 2024): > Yes that's exactly that Okay, I'll refactor the code 👍🏻
Author
Owner

@kics223w1 commented on GitHub (Apr 15, 2024):

@mariusvn
The new release 2.14.0 contains the fixed, please give it a try when you get a chance 🚀

Allow List's now working with Map Remote as usual, you don't need to turn off Allow List when using Map Remote Tool.

I also refactored the code in Map Remote Tool to update the origin header 👍🏻

<!-- gh-comment-id:2056793766 --> @kics223w1 commented on GitHub (Apr 15, 2024): @mariusvn The new release 2.14.0 contains the fixed, please give it a try when you get a chance 🚀 Allow List's now working with Map Remote as usual, you don't need to turn off Allow List when using Map Remote Tool. I also refactored the code in Map Remote Tool to update the origin header 👍🏻
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-windows-linux#396
No description provided.