Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websockets can't connect through reverse proxy #12045

Open
FrancisLLSW opened this issue Aug 30, 2024 · 2 comments
Open

Websockets can't connect through reverse proxy #12045

FrancisLLSW opened this issue Aug 30, 2024 · 2 comments

Comments

@FrancisLLSW
Copy link

Hello there,
I've encountered a blocker at work with GraphQL subscriptions over WebSockets, and I need some help.

The tech stack in my company requires an Angular front-end to connect to a Dotnet 8 back-end through a Dotnet reverse proxy (YARP, basically using proxy's localhost:[portA] and being redirected to the back-end project's localhost:[portB]).

If I set the back-end project's URL directly, the connection is successful and the subscription works perfectly. But when using the Reverse Proxy URL, Apollo can't establish a WebSocket connection. I'm certain that the Reverse Proxy is allowing those connections correctly because the YARP documentation explicitly states that WebSockets are allowed by default, and I was able to successfuly subscribe to the back-end using Postman (a Chromium-based app) with the Reverse Proxy URL.

Due to the nature of the project, I cannot provide code to replicate my environment, even though the front-end part is the text-book implementation of a GraphQLWsLink with a split link.

I've experienced a very strange behavior regarding this issue:
First, a month ago I encountered this problem and spent a few days investigating it. One day, out of desperation, I tried running every troubleshooting agent in Windows that was related to network configurations. Mysteriously, websocket connections were working fine after that! Barely for a month, anyway, and I was never too confident that the troubleshooting did it as none of them found any problems on my PC.
The other flabbergasting behavior is the fact that other colleagues have been able to run my code and didn't have any problems with the websockets whatsoever. Same configuration, same everything. Obviously I've tried every possible scenario: admin privileges when building any of the projects, re-installing everything, turning on and off the WebSocket feature in IIS, switched browsers, reinstalled browsers, checked network configurations (even if it's projects running locally). This is worrying me, especially after this month without issues, because I cannot really know if it could happen again to another colleague during development, or even in a production environment.

Over the dozen hours I've been stuck at this, I found this ticket that might be related to my problem, but it was never closed #8356

Thank you for reading this, and I hope you can point me in the right direction to solve this frustrating mystery.

@alessbell
Copy link
Member

Hi @FrancisLLSW 👋 I'm sorry for the frustration - that sounds like quite the mystery and I understand your fear of the issue returning. Were there any notable differences you can share between the environment on your machine and your colleagues' who had no problem running it with the reverse proxy url? Unfortunately without being able to debug in an environment that's reproducing the issue, the best we can do is guess.

@FrancisLLSW
Copy link
Author

Hi again, and thanks for the quick answer!
As far as we know, we have pretty much the same network configuration and are using the same laptop model with all apps updated at the same time by the company.

@github-actions github-actions bot removed the 🏓 awaiting-contributor-response requires input from a contributor label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants