Avoiding Preflight calls

Anantha Subramanian 46 Reputation points
2022-01-21T13:26:56.4+00:00

I have frontend react app deployed in Az CDN and backend in Az App service. How can I avoid CORS issue i.e. avoiding preflight calls? Please suggest a solution.

Azure Firewall
Azure Firewall
An Azure network security service that is used to protect Azure Virtual Network resources.
564 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,136 questions
Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
956 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SaiKishor-MSFT 17,181 Reputation points
    2022-01-25T23:54:59.127+00:00

    @Anantha Subramanian Thank you for reaching out to Microsoft Q&A.

    I see that you are facing CORS issues. As mentioned in our docs, For wildcard or single Origin scenarios,

    CORS on Azure CDN will work automatically with no additional configuration when the Access-Control-Allow-Origin header is set to wildcard (*) or a single origin. The CDN will cache the first response and subsequent requests will use the same header.

    If requests have already been made to the CDN prior to CORS being set on your origin, you will need to purge content on your endpoint content to reload the content with the Access-Control-Allow-Origin header.

    For multi origin scenarios, please read this doc further to understand how to correct this. Here is how to handle CORS when using Azure CDN premium for Verizon.

    Hope this helps.

    Please let us know if you have any further questions and we will be glad to assist you further. Thank you!

    Remember:

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

    Want a reminder to come back and check responses? Here is how to subscribe to a notification.