How to route using Front Door to two Web applications Static App and Web App?

František Lorenc 0 Reputation points
2024-11-26T13:58:31.0966667+00:00

Hi,

I have FrontDoor set up to route to a Web App.

CleanShot 2024-11-26 at 14.33.40@2x

This works perfectly.

Now I want to route using the route /breakingnews/ to a Web Static App running on a different URL.

I have set up a new route to new Origin groups.

CleanShot 2024-11-26 at 14.36.52@2x

Here is Origin group:

Google Chrome 2024-11-26 14.38.46

CleanShot 2024-11-26 at 14.48.14@2x

The file staticwebapp.config.json contains:

{
  "navigationFallback": {
    "rewrite": "/index.html",
    "exclude": ["/images/*.{png,jpg,gif}", "/css/*"]
  },
  "forwardingGateway": {
  "requiredHeaders": {
    "X-Azure-FDID" : "FDID"
  },
  "allowedForwardedHosts": [
    "mspadminwebfdedev-XXXXXXXX.z01.azurefd.net"
  ]
}
}

But something is wrong. Because when I enter the URL I get an HTTP 404.

CleanShot 2024-11-26 at 14.56.53@2x

I don't have any rules.

I would like to ask for advice on how to set this up? Thank you very much.

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
708 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,084 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,020 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rohith Vinnakota 1,515 Reputation points Microsoft Vendor
    2024-11-26T20:14:03.4266667+00:00

    Hi František Lorenc,

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    I understand that you've setup Azure Front Door with two routes, out of which one is working fine but the other one is not.

    I have created setup Front Door (standard) endpoint to route azure static websites like below:

    User's image

    To resolve this issue add a routing rule like below:
    User's image

    Please find the below document for more information on Patterns to match and origin path usage:

    https://learn.microsoft.com/en-us/azure/frontdoor/how-to-configure-endpoints#add-a-route

    Patterns to match - Configure all URL path patterns that this route accepts. For example, you can set the pattern to match to /images/* to accept all requests on the URL www.contoso.com/images/*. Azure Front Door determines the traffic based on exact match first. If no paths match exactly, then Front Door looks for a wildcard path that matches. If no routing rules are found with a matching path, then the request get rejected and returns a 400: Bad Request error HTTP response.

    Origin path: This path is used to rewrite the URL that Azure Front Door will use when constructing the request forwarded to the origin. By default, this path isn't provided. As such, Azure Front Door will use the incoming URL path in the request to the origin. You can also specify a wildcard path, which will copy any matching part of the incoming path to the request path to the origin. Origin path is case sensitive. Pattern to match: /foo/* Origin path: /fwd/ Incoming URL path: /foo/a/b/c/ URL from Azure Front Door to origin: fwd/a/b/c.

    Kindly let us know if the above helps or you need further assistance on this issue.

    Thanks,

    Rohith.


     

    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    User's image

    1 person found this answer 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.