Azure / azure-signalr

Azure SignalR Service SDK for .NET
https://aka.ms/signalr-service
MIT License
426 stars 100 forks source link

Why does APIMS cause CORS issue for Socket Negotiate #2054

Closed Shaieb524 closed 1 month ago

Shaieb524 commented 1 month ago

I have an APIMS that is connected to a web API that enables CORS and Websocket connections.

When I connect my Angular client directly to the API everything works fine, but when I connect, is to the APIMS I get CORS error for negotiating requests.

image

When I tried to connect my Angular client app directly to my Backend Azure App Serivce, everything was fine (I had to check the Enable Access-Control-Allow-Credentials) and it worked even with wildcard domains for the client.

But now I can't do the same for APIMS.

I added Inbound CORS policy for APIMS for this API (All Operations) but still get the same error.

What am I missing? And is there any step to be done between the APIMS and the Web API other than the regular links (BTW all HTTP requests are working fine)?

vicancy commented 1 month ago

Here is a doc integrating with APIM FYI https://learn.microsoft.com/azure/azure-signalr/signalr-howto-work-with-apim

Shaieb524 commented 1 month ago

Solved, the issue was i had to remove line from the All operations CORS policy because it was overwritten by the inherited global policy (this is what means) and to check the current policy you can hit the Calculate effective policy

image