mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-27 17:15:49 +03:00
[GH-ISSUE #1055] [Bug] Proxyman breaks web sockets when websocket subprotocols are specified #1049
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1049
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Bertrand on GitHub (Nov 2, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1055
Originally assigned to: @NghiaTranUIT on GitHub.
Proxyman version
23410
macOS Version
11.5.2
Description
We're using a websocket client for graphql subscriptions from a web client.
When Proxyman is started, the web browser is unable to connect to the websocket server.
This is because the graphql subscription library that we use passes a suprotocol at connect time (namely "graphql-ws").
We've been able to isolate the issue in a very simple node server:
proxyman-ws-sample.zip
Steps to reproduce
Then
Result
(*) the subprotocol doesn't impact the result, but at least "amqp" is a well-known subprotocol from IANA registry
@NghiaTranUIT commented on GitHub (Nov 3, 2021):
Thanks for the detailed report @Bertrand. I love it 👍
I'm able to reproduce it on my side, let me fix it 🙌
@NghiaTranUIT commented on GitHub (Nov 3, 2021):
My preliminary investigation shows that Swift-NIO Websocket doesn't support
Sec-WebSocket-Protocol: amqp. Therefore, it drops the connection before it sends any message.@NghiaTranUIT commented on GitHub (Nov 3, 2021):
If you open 0.0.0.0:3000 on Firefox or Safari, it does work. Not sure what causes the problem if we use Chrome
@NghiaTranUIT commented on GitHub (Nov 3, 2021):
@Bertrand commented on GitHub (Nov 3, 2021):
Hello @NghiaTranUIT
I do confirm I'm able to reproduce the issue with swift-nio sample websocket server.
https://github.com/apple/swift-nio/tree/main/Sources/NIOWebSocketServer
At least now we can both investigate the issue :)
@Bertrand commented on GitHub (Nov 3, 2021):
Ok, I've found the issue.
It's due to the websocket server not returning the "elected" subprotocol in the response.
In swift-nio sample, I replaced the upgrader code :
with
This code pretends that the server understand any of the subprotocols requested by the client.
And now everything works fine 😃
In short, Chrome will automatically close a websocket at upgrade time if the server doesn't claim to support one of the suprotocols asked by the client at request time.
The other browsers don't.
Hope this helps you fix the issue on your side.
@NghiaTranUIT commented on GitHub (Nov 3, 2021):
Wow. you're my rescuer @srebalaji, it took me this morning to investigate but I didn't realize it.
I really appreciate it 🙇
Please try this Beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.34.1_Fix_WS_with_subprotocols.dmg
@Bertrand commented on GitHub (Nov 4, 2021):
Yes it works perfectly !!!
Many many thanks 😃 😃
@tkrajacic commented on GitHub (May 5, 2022):
Did this fix ever make it into a release? If so, this issue can be closed I guess?
(I am investigating why I can't connect to a websocket channel in Firefox when Proxyman is running - cert properly installed and all)
@adminfairjungle commented on GitHub (May 5, 2022):
From my standpoint, this problem was fixed then and I never experienced similar issues since.
@NghiaTranUIT commented on GitHub (May 5, 2022):
Yes, this issue is fixed since build 2.35.0 👏