如何通过自定义域重定向或重写访问 Azure blob 存储文件而不导致浏览器安全警报​​?

how to have Azure blob storage files be reachable via custom domain redirect or rewrite without resulting in browser security alerts?

这是对我昨天的问题的跟进

objective 是为了让 blob 存储文件可以通过我们的自定义域访问并在 google 上排名,例如:http://contoso.com/docs/product1-specs.pdf

这是一个新网站,因此无需担心需要从旧 links 重定向。

所以在 "contoso.com/product1" 上的 html 文件中你会有一个内部 link 例如

<a href="/docs/product1-specs.pdf">product 1 specs</a>

其中 "contoso.com" 是由 Azure 应用服务托管的自定义域 其中 "contoso1.blob.core.windows.net" 是 Azure 存储帐户 "contoso1" 其中“/docs/product1-specs.pdf”表示存储在 Azure 存储中的容器 "docs" 中的 blob 文件 "product1-specs.pdf"。

这是一个由四部分组成的问题:

问题第 1 部分:实现此内部 link 并从 Azure 存储检索 blob 的 SEO 友好且正确的技术方法是什么?当然,作为外部资源获取的外部 link contoso.com/docs/product1-specs.pdf 也需要是有效的可检索 url.

是否: a) 将存储帐户的自定义域设置为子域资产。contoso.com 然后对 contoso 执行 url rewrite/redirect。com/docs/* b) 将存储帐户的自定义域设置为 contoso.com,然后对 contoso 执行 url rewrite/redirect。com/docs/* c)不同的东西

我不想托管和管理具有资产的单独站点的排名。contoso.com - 我希望将 blob 组织在 "docs" 容器中,在线显示为如果它是一个名为 "docs".

的文件夹

问题第 2 部分:我创建了一个名为 "iprobesolutions" 的测试 Azure 存储帐户,并根据此屏幕截图将自定义域设置为 iprobesolutions.com:

https://www.dropbox.com/s/45u6iczcnusuxvl/Screenshot%202016-05-31%2010.31.40.png?dl=0

按以下顺序执行以下步骤是否正确: 1) 在 Azure 存储帐户中设置 iprobesolutions.com 作为自定义域 iprobesolutions.com 2) 按照屏幕截图如下设置 iprobesolutions.com 的 DNS 记录: https://www.dropbox.com/s/xqw2d9k3gj6mnjs/Screenshot%202016-05-30%2021.30.22.png?dl=0 和 DNS 配置将 iprobesolutions.com 指向 iprobesolutions.blob.core.windows.net 3) 最后设置 URL 重写配置

或者我是否只需要 URL 重写配置而无需在 Azure 存储中设置自定义域?

问题第 3 部分:

对于 URL 配置部分,无论是作为第 3 步完成还是作为单个步骤完成,查看这个问题 How to map Azure Blob with container with a custom domain sub-directory? 和另一个来源,以下两个是正确的 web.config IIS 8.5 的重定向,两者之间有什么区别?如前所述,无需担心维护旧的 links,因为它是一个新网站。我不清楚对于我们的特定用例,我们是否需要重定向或只是重写?

目标是让 iprobesolutions.com/docs/product1-specs.pdf 成为规范名称(而不是 Azure blob 名称),

  <rule name="redirect-docs" stopProcessing="true">
                <match url="docs/(.*)"/>
                <action type="Redirect" url="https://iprobesolutions1.blob.core.windows.net/docs/{R:1}"></action>
              </rule>


<rule name="docs redirection" stopProcessing="false">
    <match url="docs/(.*)" ignoreCase="true" />
    <action type="Redirect" url="https://iprobesolutions.com/docs/{R:1}" redirectType="Permanent" appendQueryString="true" logRewrittenUrl="true" />
  </rule>

问题第 4 部分:由于 iprobesolutions1.blob.core.windows.net 被强制作为 HTTPS 连接,正在通过我们的 HTTP 网站将其转换为 HTTP 连接,这将导致某些浏览器发出安全警报的误报,如果那么,避免这些误报的解决方案是什么,而不是突然被迫购买 TSL 证书以强制 HTTPS 连接到 iprobesolutions.com,因为它被设置为静态营销网站。

感谢您抽出宝贵的时间阅读,我希望有人可以根据他们面临与我类似情况的经验发表意见!

首先,您不能将根域同时映射到应用服务和存储帐户。我已经在你的其他帖子中回复了。

此外,请注意 google 要求所有网站都使用 HTTPS,否则您的网站将受到处罚。只是要考虑其他事情。