Hello @Xavier Casals Virosque ,
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.
On checking your configuration, I see that the patterns to match is set to /admin/*
and the origin path is set to "/admin/" in the route but the incoming URL path is /assets/xyz.png
.
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 URLwww.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.
So, in your case, if we see the route named "Admin", below is happening:
Domain: mydomain.com
Patterns to match: /admin/*
Origin path: /admin/
Incoming URL path: /assets/xyz.png
URL from Azure Front Door to origin: mydomain.com/assets/xyz.png
The path "/admin" is not getting added because the requested URL doesn't have any pattern to match.
You will need to add a valid pattern to match path in the route and then you can add Origin path: /admin/ to rewrite that path to admin.
Or maybe you can try the below route depending upon your setup, after validating that it doesn't affect other request paths or URLs:
Kindly let us know if the above helps or you need further assistance on this issue.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.