Ionic angular web app throwing 404 when hosted on Azure Storage Accounts

Ravi Kumar Dega 21 Reputation points
2022-02-03T02:02:01.673+00:00

Hi, I have built and deployed an Ionic Angular web app to Storage accounts using Azure DevOps. To access the webpages I have configured Azure CDN. The home page of the website loads correctly but the subsequent pages throw 404 and even a refresh throws 404. Any help or guidance is appreciated. Thank you!

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,683 questions
Azure Content Delivery Network
{count} votes

Accepted answer
  1. suvasara-MSFT 10,001 Reputation points
    2022-02-06T09:07:26.627+00:00

    @Ravi Kumar Dega , This is expected behavior while you are hosting a static website on Azure storage account. The blob endpoint serves data only for the index.html path and throws 404 errors whenever there is an unknown path in the URL. While refreshing there are chances of adding extra elements to the URL of the blob that causes the 404 error. There are two ways in which you can avoid this 404 error for unknown paths,

    Replace Error document with Index.html,

    171661-image.png

    or

    Use Azure CDN rules engine concept for rewriting the source path to destination index.html,

    171587-image.png

    ----------

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful