Offload CORS to Front Door

Daniel Matthews 25 Reputation points
2025-08-06T09:23:17.2966667+00:00

Hi,

According to the documentation (https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/troubleshoot-cross-origin-resources) it is possible to configure a rule to manage CORS origins.

However, it appears that Front Door can not respond to preflight requests itself without routing to the origin. The rule described in the documentation merely decorates a response with CORS headers. This defeats the point of off-loading it to the edge, as I still have to handle it on the backend.

Am I misunderstanding this or is there any other way for AFD to handle this?

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
0 comments No comments
{count} votes

Accepted answer
  1. Alex Burlachenko 13,330 Reputation points Volunteer Moderator
    2025-08-06T09:32:52.6+00:00

    Daniel Matthews hi,

    thanks for dropping this question, its a good one and i get why u're scratching ur head over it )

    u're actually spot on about how azure front door handles cors right now. the rule engine can add cors headers to responses, but it won't fully intercept preflight options requests. those still get passed through to ur origin server. kinda annoying, right?

    for the full cors offload dream, u'd need something that can respond to options requests at the edge. azure front door isn't quite there yet, but there are ways to make it work better ))

    check this microsoft doc that explains the current behavior https://learn.microsoft.com/en-us/azure/frontdoor/standard-premium/troubleshoot-cross-origin-resources. it shows how to set up those response header rules properly.

    if u're using azure app service or azure functions, u could set up a lightweight cors handler there that just responds to options. not perfect, but better than handling full cors logic.

    also worth looking into azure api management - it has more robust cors handling features that might do what u need. its not front door, but could be part of ur solution ))

    if u're using cloudflare or another cdn in front of front door, some of them handle cors better. just saying )

    let me know if this helps

    Alex

    and "yes" if you would follow me at Q&A - personaly thx.
    P.S. If my answer help to you, please Accept my answer
    

    https://ctrlaltdel.blog/


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.