@Konrad Kaliciński WebSocket support is typically enabled by default on Azure App Service for Linux, it's advisable to verify this setting. You can do so by accessing the Azure Portal, navigating to your App Service, and under the "Settings" section, selecting "Configuration." There, ensure that "Web sockets" is turned on within the "General settings" tab.
Next, consider your CORS configuration. While you have configured CORS in your socket.io
server settings, Azure App Service has its own CORS settings that need to be adjusted. In the Azure Portal, go to your App Service, and under "API" in the left-hand menu, click on "CORS." Add your client app's URL (e.g., https://my-client-app.app
) to the list of allowed origins to ensure proper communication between the client and server.
Additionally, if your app is behind a firewall or utilizes a Virtual Network (VNet), confirm that the firewall or network security group rules permit traffic on the port used for WebSocket connections, typically port 8080. On the client side, verify that your socket.io-client
is configured to connect to the correct URL and port, as misconfigurations here can often lead to connectivity issues.
Security is another crucial aspect; if your client app is served over HTTPS, ensure that your WebSocket connections are also secure by using wss://
instead of ws://
. Keep an eye on both server and client-side logs for any error messages or clues that might provide further insight into the issue.
Lastly, if you're using a custom domain, make sure that SSL/TLS is properly configured both on Azure and with your domain registrar. Also, be aware that Azure App Service may handle cross-origin requests differently based on request types, so ensure that both HTTP and WebSocket requests are set up to manage CORS appropriately. If the issue persists despite these checks, consider simplifying your setup or deploying to a different environment to further isolate the problem.