Search code examples
azureazure-application-gatewayazure-load-balancerazure-static-web-appazure-front-door

How to set up Azure Front Door (Standard/Premium) to forward HTTP requests to Static Web App


I want to be able to forward all request to an endpoint configured in Azure Front Door (e.g. mydomain.com/foo/bar) to a Static Web App (silly-name-1a2b3c.azurestaticapps.net).

I need the request to be forwarded and not redirected, so basically a reverse proxy. I don't want the customers to see the Static Web App's original address (silly-name-1a2b3c.azurestaticapps.net).

I need to use Azure Front Door because my domain (mydomain.com) is already configured there and I don't want to have it configured in multiple places.

I came upon sample configurations of Azure Front Door classic but it differs a lot from Azure Front Door Standard/Premium. I started wondering if Azure Front Door Standard/Premium by itself is even able to support such a use case. Perhaps there is a need for another service between Azure Front Door and the Static Web App.

I've already tried to configure it as desribed in the manual prepared by Microsoft (https://learn.microsoft.com/en-us/azure/static-web-apps/front-door-manual) but it didn't work.

I was able to set up request redirection and it works but as I mentioned, I want the requests to be forwarded.

Could you direct me to some sources about the desider setup and confirm/deny my suspicions about the limitatations of Azure Front Door Standard/Premium?


Solution

  • You need to create a route as shown in the quickstart tutorial where you set path patterns to match and define an origin group to forward the requests to.

    If you need to use rule sets, you need to use the URL Rewrite rule instead of URL Redirect.

    Your source pattern would be mydomain.com/foo/bar and destination pattern would be silly-name-1a2b3c.azurestaticapps.net. You might also want to preserve unmatched path to ensure that goes to your backend as-is.