URL 在没有 $web 的情况下在 Azure 上托管静态网站
Host static website on Azure without $web in URL
按照 Static website hosting in Azure Storage and Add a custom domain to your endpoint 中的说明,我已经设法通过 Azure CDN 获得了一个带有自定义域和 https(尽管带有“www”子域)的静态网站。
但是,blob 端点以“/$web/index.html”结尾,这也是访问自定义域所必需的。所以它的形式是:
https://www.<customdomain>.com/$web/index.html
由于我使用的 SPA 框架,它立即变为:
https://www.<customdomain>.com/$web/index.html#/home
有点长
我看到了在根自定义域上处理 https 的说明,如果我有勇气,可能会尝试一下。但是有没有办法抑制 /$web/index.html
部分?目前,如果我去:
https://www.<customdomain>.com
我得到:
<Error>
<Code>InvalidQueryParameterValue</Code>
<Message>Value for one of the query parameters specified in the request URI is invalid. RequestId:...</Message>
<QueryParameterName>comp</QueryParameterName>
<QueryParameterValue/>
<Reason/>
</Error>
不要将您的自定义域映射到常规 blob 端点(例如 https://mystorageaccount.blob.core.windows.net/
),请尝试将其映射到类似于 https://mystorageaccount.z22.web.core.windows.net
.
的静态网站端点
完成后,您将不需要在请求中指定 $web
,因为此端点始终从 $web
blob 容器中获取内容。
您可以在 Azure 门户中的存储帐户的 Static website
部分找到存储帐户的静态网站端点。
按照 Static website hosting in Azure Storage and Add a custom domain to your endpoint 中的说明,我已经设法通过 Azure CDN 获得了一个带有自定义域和 https(尽管带有“www”子域)的静态网站。
但是,blob 端点以“/$web/index.html”结尾,这也是访问自定义域所必需的。所以它的形式是:
https://www.<customdomain>.com/$web/index.html
由于我使用的 SPA 框架,它立即变为:
https://www.<customdomain>.com/$web/index.html#/home
有点长
我看到了在根自定义域上处理 https 的说明,如果我有勇气,可能会尝试一下。但是有没有办法抑制 /$web/index.html
部分?目前,如果我去:
https://www.<customdomain>.com
我得到:
<Error>
<Code>InvalidQueryParameterValue</Code>
<Message>Value for one of the query parameters specified in the request URI is invalid. RequestId:...</Message>
<QueryParameterName>comp</QueryParameterName>
<QueryParameterValue/>
<Reason/>
</Error>
不要将您的自定义域映射到常规 blob 端点(例如 https://mystorageaccount.blob.core.windows.net/
),请尝试将其映射到类似于 https://mystorageaccount.z22.web.core.windows.net
.
完成后,您将不需要在请求中指定 $web
,因为此端点始终从 $web
blob 容器中获取内容。
您可以在 Azure 门户中的存储帐户的 Static website
部分找到存储帐户的静态网站端点。