We are hosting our angular app on Azure CDN (verizon premium) and rewrite works well except when the URL looks like this: https://example.com/main/getuser/user.name
Then i'm getting 404.
If the URL is
https://example.com/main/getuser/username
everything is fine. I understand that the problem is the dot .
but can't figure out the right regex.
I have 2 rewrite rules:
/123456/path/((?:[^\?]*/)?)($|\?.*)
-> /123456/path/angular-files/index.html$2
/123456/path/((?:[^\?]*/)?[^\?/.]+)($|\?.*)
-> /123456/path/angular-files/index.html$2

- 37
- 1
- 5
-
maybe this can help you: https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#fallback-routes – ZiTAL Aug 05 '21 at 13:00
-
I don't see how will that help – Stuka Aug 12 '21 at 10:02
1 Answers
You can try the below solution :
For the Pattern, Use
[^?.]*(\?.*)?$.
This pattern catches URL paths with.
in them, but doesn't care whether or not it's in the query string.For the source Path, enter
origin_path/document.ext
.The Path is relative to the origin root. For example, if your CDN endpoint's origin path is/origin_path
and you want to redirect toindex.html
, you would enterorigin_path/index.html
. This will always be the case if your CDN is backed by an Azure Storage Account and the origin points to a container.The Destination pattern will be the origin path which is set in your Azure portal settings + index.html. So if your origin path is
"/cdn"
then in the Destination pattern you would write,"cdn/index.html"
Click Add to add your rule and wait some time, it should resolve the issue.
Note: Please add a public access to blobs and containers for azure storage account, otherwise CDN will error out blob not found.
Reference:

- 9,705
- 2
- 10
- 27