Adventures with APIM: Blazor WebAssembly CORS Issues

API Management

For the past couple of hours days I have been battling an issue 🤔 where my CORS policy in APIM did not seem to be working for my Blazor WebAssembly application.

I thought I had my APIM policy correct, allowed-origins and allowed-methods looked good.

https://gist.github.com/mattruma/9a07eb3e63227ae57928343b2a2c4846#file-policy1-xml

Still was receiving the CORS issue?! 😤

Thought I had this problem before but wasn’t sure what I did to fix it.

Then it finally dawned on me 💡 … it is the Headers. I needed to set Allowed headers to * in my APIM CORS policy.

https://gist.github.com/mattruma/9a07eb3e63227ae57928343b2a2c4846#file-policy2-xml

Once I made that change, no more CORS issue! 😀

Hopefully this saves someone, including my future self, a headache or two!

1 Reply to “Adventures with APIM: Blazor WebAssembly CORS Issues”

Leave a Reply

Your email address will not be published. Required fields are marked *