Azure Front Door URL Rewrite rules not working as planned

David Echo 116 Reputation points
2021-05-20T13:40:03.433+00:00

I have set up Azure Front Door. There are several App Services set up as such:

https://www.thisismydomain2021.com/appservice1 --> https://this-is-my-app-service-1.azurewebsites.net
https://www.thisismydomain2021.com/appservice2 --> https://this-is-my-app-service-2.azurewebsites.net

The matching is using the "/appservice1/", "/appservice2/".

I do not want those matching paths to make it through to the App Services. For Example:

https://www.thisismydomain2021.com/appservice1/this/folder/makeitso.html --> https://this-is-my-app-service-1.azurewebsites.net/this/folder/makeitso.html

I did try pretty much everything to remove "appservice1" and appservice2" from the origin URL using a rule set.

Condition: Request Path Contains "/appservice1/" Case transform To Lower
Action: URL Rewrite Source Pattern: "/appservice1/" Destination: "/" Preserve unmatched path: Yes

The only one that I managed to see do any action in the logs was this:
Condition: Request Path Contains "/appservice1/" Case transform To Lower
Action: URL Rewrite Source Pattern: "/" Destination: "/testaddition/" Preserve unmatched path: Yes

And the result is shown below. Not what I wanted, but it proved that it is possible to rewrite the URL in some way, just not how I want it.:
https://this-is-my-app-service-1.azurewebsites.net/appservice1/testaddiition/this/folder/makeitso.html

Any help greatly appreciated.
Thank you
David

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
546 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sruthi Saranya Karthikeyan 231 Reputation points Microsoft Employee
    2021-06-01T10:00:06.373+00:00

    Hello @David Echo ,

    Have you tried configuring the specific match path as /appservice1/* and the custom forwarding path as '/' in the routing rule?

    I think this should help with the specific configuration that you wish to have. You can refer to the following page for examples: https://learn.microsoft.com/en-gb/azure/frontdoor/front-door-url-rewrite

    Do feel free to reach out in case of any additional questions or concerns or if the above suggestion doesn't work.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


  2. Paweł Żółtaniecki 1 Reputation point
    2022-10-20T16:39:47.87+00:00

    But how we can use rewrite in proper way. It is not working at all