Routing for specific files in Azure front Door

Viewed 37

I have an application which if fronted with Azure Front Door. I need to add a robots.txt to the root of the domain and cannot host that within the application.

I was hoping to add the robots.txt to a storage blob /robots/robots.txt and setup a new route for /robots.txt and an origin of /robots/robots.txt but this appears as /robots/robots.txt/robots.txt in the back end.

What do I set the origin path to to find the correct file?

1 Answers

Unfortunately, any matched pattern is replaced by the origin path, this apparently includes file names. To go around this in this scenario, we can use a URL rewrite rule instead.

Origin Group configuration
Pattern to match: /robots.txt
Origin path: /

Rule Set Rules:
Action: URL Rewrite
Source pattern: /
Destination: /robots/robots.txt
Preserve unmatched path: No

Related