Azure Storage Static website error - Resource not found or content doesn't exist

若如初见. 提交于 2020-04-14 07:48:18

问题


To see how static websites work in Azure storage, I created a basic angular app and uploaded the files in dist folder to the static website. But when I try to access the URL, I get a 404 error message that says "The requested content doesn't exist".

Also, I can see that files are present under $web path, but when I click on the file URL <azurestorageurl>/$web/index.html the browser throws an error message "Resource not found".

.


回答1:


The reason you're getting this error is because the ACL of the $web blob container is Private by default.

Please change the ACL to either Blob (recommended) or Container and you should not see this error.

UPDATE

So I reached out to Azure Storage team and brought this question to their attention. They were kind enough to explain the behavior to me.

Essentially if you access the static website's contents through the static website endpoint (e.g. account.z5.web.core.windows.net), there's no need to change the blob container's ACL. Contents should be accessible even if the ACL of $web is Private. Blob container's ACL comes into picture when you access the content through blob storage endpoint (e.g. account.blob.core.windows.net).




回答2:


I had quite a similar issue hosting an Angular app on Azure storage account static site, I was getting the below error when reloading the page or navigating by URL. I had to set the Angular Router to use HashLocationStrategy instead of the default strategy. Also, because I am using ASP boilerplate (ASPNetZero) I had to add it to the RootRoutingModule.

This is now working for me on refresh and navigating by changing the URL manually.

Angular Hash Location Strategy



来源:https://stackoverflow.com/questions/56057614/azure-storage-static-website-error-resource-not-found-or-content-doesnt-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!