azureazure-web-app-serviceazure-front-door

How to forward access-control-allow-origin header from a Web App to a Front Door?


I currently have a web app running in containers with the access-control-allow-origin header correctly configured on it. However, when I check the front door in front of this web app, the same header has the option '*' -- accepting all types of requests, differently from the configured one.

How do I get the front door to propagate this web app header?


Solution

  • Here is the official document about this: Azure Front Door Rule Set

    On Azure Front Door, you can create a rule in the Azure Front Door Rules Set to check the Origin header on the request. If it's a valid origin, your rule will set the Access-Control-Allow-Origin header with the correct value. In this case, the Access-Control-Allow-Origin header from the file's origin server is ignored and the AFD's rules engine completely manages the allowed CORS origins. enter image description here