How do I allow web socket connections on an Azure Static Web App

Michael Bellmore 1 Reputation point
2022-06-09T14:35:44.76+00:00

We have an angular front end that is connecting to a SignalR hub and are attempting to get it running as an Azure static web, but the connections are failing.

This is the error message.

main.js:1

   [2022-06-09T14:27:28.831Z] Error: Failed to start the connection: Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.  

This works when we host the site on an Azure App Service.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,334 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
124 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
793 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Bellmore 1 Reputation point
    2022-06-14T18:56:42.133+00:00

    Turns out it was just a timing issue. It appears that it takes a while for Azure to process updates to CORS rules in an app service.
    When I attempted to connect on Monday, everything was working so I'm guessing that it takes 24 hours or so to process the updates to CORS rules on an App Service within Azure.