【发布时间】:2018-04-06 06:35:09
【问题描述】:
我使用 angular-cli 构建了我的 Angular 应用程序。
注意我使用的是 PathLocationStrategy 路由策略,由于其他限制我不能使用 HashLocationStrategy。
我已将所有静态文件上传到 Azure 存储 Blob 中的“前端”容器中。除了我遇到的两个限制之外,该应用程序运行良好:
- 用户必须输入完整的 URL,而不仅仅是域名(即https://someblob.blob.core.windows.net/frontend/index.html)
- 当用户按下浏览器刷新时,返回 404 错误。
使用 Azure Functions Proxies 和以下 proxies.json 文件,我设法解决了第一个限制。 IE。用户可以通过浏览 some-azure-function.azurewebsites.net 来访问该应用程序。但不是第二个。
有没有办法同时使用 Azure Functions Proxies 解决第二个限制?
proxys.json:
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"refresh": {
"matchCondition": {
"route": "/frontend/"
},
"backendUri": "https://someblob.blob.core.windows.net/frontend/index.html"
},
"allfiles": {
"matchCondition": {
"route": "/frontend/{*rest}"
},
"backendUri": "https://someblob.blob.core.windows.net/frontend/{rest}"
},
"root": {
"matchCondition": {
"route": "/"
},
"backendUri": "https://someblob.blob.core.windows.net/frontend/index.html"
}
}
}
【问题讨论】:
标签: angular azure-blob-storage azure-functions azure-function-app-proxy