0

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.
enter image description here 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

rewrites

Stuka
  • 37
  • 1
  • 5

1 Answers1

0

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 to index.html, you would enter origin_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:

SO thread

Ansuman Bal
  • 9,705
  • 2
  • 10
  • 27