angular - 具有 Blob 存储的 Azure CDN : WebContentNotFound when using Origin Path

标签 angular azure single-page-application azure-blob-storage azure-cdn

我们有一个托管在 Azure Blob 存储中的静态网站( Angular ),其中包含 web$ 文件夹和所有选项集。

见下图:

enter image description here enter image description here

当我们将网站放入 Blob 存储的根文件夹 web$ 中时,一切正常。当我们重新加载页面时,所有页面/路由都会重定向到 SPA 的 index.html。

但是我们需要在同一个 web$ 文件夹上托管多个静态站点。 因此,我们创建了文件夹,并将选项“原始路径”设置为创建的每个端点的目标文件夹。

我们现在有: /folder1/index.html 表示 CDN 中的第一个端点 /folder2/index.html 用于 CDN 中的第二个端点

一切正常,但无法重新加载。一旦我们刷新页面,CDN 端点就不会检索目标文件夹。

我们有另一个项目,相同的配置工作正常,但我们发现它是我们的 PWA 的 serviceworker 正在缓存index.html(而不是 CDN) 但我们需要一个没有 serviceworker 的解决方案。

也许有重定向规则?

[编辑]2019 年 3 月 2 日

这是我尝试重新加载时出现错误的打印屏幕

enter image description here

这是我们拥有的多个端点之一的配置:

enter image description here

容器中 Web$ 文件夹的内容:

enter image description here

最佳答案

如果您想对源路径上的每个“子文件夹”路径使用 CDN,请尝试在 源路径中输入 /folder1/folder2 字段。

对于 Azure CDN 端点返回 404 状态代码,有多种可能的原因,包括:

  • The file's origin isn't visible to the CDN.
  • The endpoint is misconfigured, causing the CDN to look in the wrong place.
  • The host is rejecting the host header from the CDN.
  • The endpoint hasn't had time to propagate throughout the CDN

您可以尝试troubleshooting steps

关于angular - 具有 Blob 存储的 Azure CDN : WebContentNotFound when using Origin Path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60402039/

相关文章:

azure - 如何在 Azure 开发测试实验室中启用更新管理

c# - 带有 docker microsoft/iis 的卷

ab-testing - 您如何为单页应用程序设置 Optimizely 测试?

javascript - Angular 5 httpClient - 使用 PUT jsonplaceholder 404

angular - 根据用户操作重置可观察计时器?

javascript - 操作第三次运行时未触发效果

javascript - 我在 Node.js Express 中遇到一些关于路由的问题

angular - ivy 错误 - ngcc 编译器自上次 ngcc 构建以来已更改

azure - 新的 Azure SDK 1.7 和增强的发布是否允许自动将静态文件发布到 Blob 存储?

angularjs - 将Web Api作为一个单独的项目托管是一种最佳实践