Randomly POST calls are being blocked for few seconds

Animesh Anand 15 Reputation points

One weird thing is happening, Randomly POST calls via Ajax are being blocked for few seconds. We have two App services, one for web and one api, all Get calls are working but POST calls sop working. And within 1-2 seconds starts working. Sometime start working after clearing browser caches or works in incognito.

CORS is AllowAll. But the error shows that POST call has been blocked by CORS policy. No 'Access-Control-Allow-Origin' header is present on the requested resource.

But I believe error is something else, because related Preflight is 200 and it has the 'Access-Control-Allow-Origin' header present.

to send

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,185 questions
{count} vote

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 15,686 Reputation points Microsoft Employee

    @Animesh Anand it seems like there might be an issue with the OpenID Connect nonce validation. The error message indicates that RequireNonce is 'True', but OpenIdConnectProtocolValidationContext.Nonce was null, while OpenIdConnectProtocol.ValidatedIdToken.Payload.Nonce was not null. This means that the nonce cannot be validated.

    To resolve this issue, you can try setting the OpenIdConnectProtocolValidationContext.Nonce to the value of OpenIdConnectProtocol.ValidatedIdToken.Payload.Nonce. This should allow the nonce to be validated properly.

    Regarding the CORS issue, it's possible that there might be some other configuration issue that is causing the POST calls to be blocked. One thing you can try is to check the server logs to see if there are any errors or warnings related to CORS. You can also try clearing the browser cache or using incognito mode to see if that resolves the issue.