A set of technologies in the .NET Framework for building web applications and XML web services.
Hi @Hoài Nam Nguyễn ,
This error happens on the SignalR negotiate request:
POST http://localhost:8001/hubs/presence/negotiate?... net::ERR_EMPTY_RESPONSE
So the gateway is not returning any HTTP response (wrong route or the proxy can’t forward the request correctly).
Please check
- Verify the YARP route really forwards to the Presence service
Make sure the gateway route /hubs/presence/{*catch-all} points to the Presence service address + port that is actually listening (the same one you would use if you called Presence directly).
A fast test:
- call the Presence service directly:
http://<presence-host>:<port>/hubs/presence/negotiate?negotiateVersion=1 - if that works but through gateway fails, your gateway route/cluster is wrong.
- Make sure WebSockets are enabled on the gateway
SignalR uses WebSockets (or falls back to SSE/LongPolling). If WebSockets aren’t enabled in the proxy host, SignalR often fails.
If you control the gateway app code, ensure this exists:
app.UseWebSockets();
app.MapReverseProxy();
- If your React app runs in a container: don’t use
localhost:8001
Inside a container, localhost means “this container”, not the gateway container.
- React on your host browser:
http://localhost:8001/...is correct. - React in Docker/Aspire: use the gateway DNS name on the internal network (for example
http://gateway:8001/...depending on your setup).
- If you run multiple instances of the hub service behind YARP / a load balancer. Then you need:
- sticky sessions (session affinity), or
- a SignalR backplane / Azure SignalR Service
Otherwise negotiate may hit instance A, and the actual connection hits instance B.
I also recommend checking out these docs
- Aspire YARP integration (how routes/clusters are wired in Aspire): YARP integration
- Azure Application Gateway cookie-based affinity (sticky sessions) troubleshooting (relevant if you deploy behind App Gateway): Troubleshoot Azure Application Gateway session affinity issues
I hope this helps.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.
Thank you.