I have domains example.com
& www.example.com
我有Example.com和www.Example.com域名
The www.
subdomain is attached to an Azure CDN, using Microsoft CDN Classic.
I tried to map the non www.
to the CDN with the following NGINX config:
万维网。子域使用Microsoft CDN Classic附加到Azure CDN。我试着绘制非WWW的地图。使用以下Nginx配置连接到CDN:
server
{
listen 8080;
listen [::]:8080;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
The intent here is to redirect everything from https://example.com
to https://www.example.com
.
这里的目的是将所有内容从https://example.com重定向到https://www.example.com.
But it results in a site-wide 301 "Too many redirects"
.
However, when i turn off the CDN (e.g. disassociate the www.
domain), that config works just fine.
但这会导致站点范围内的301个“太多重定向”。然而,当我关闭CDN时(例如,解除与WWW的关联)域),该配置工作得很好。
I tried to add a custom non-shared SSL certificate to example.com
but that didnt fix it.
我试图向Example.com添加一个定制的非共享的SSL证书,但没有解决这个问题。
How can i make this work with the CDN?
我如何才能让CDN做到这一点?
更多回答
优秀答案推荐
I was not able to fix this at its root via NGINX config or the Azure interface but managed with a workaround:
我无法通过Nginx配置或Azure接口从根本上解决这个问题,但使用了一种解决方法:
I unregistered the non www.
domain from Azure and pointed it to an alternate webspace which then redirects to the www.
domain of the CDN.
This way www.
and non www.
are working properly with the CDN. The workaround is agreeable ugly but not noticeable to a user.
我注销了非WWW的注册。域名,并将其指向另一个网站空间,该网站空间然后重定向到WWW。CDN的域名。这样就可以了。和非WWW。与CDN合作正常。解决方法是令人愉快的丑陋,但对用户来说并不明显。
更多回答
我是一名优秀的程序员,十分优秀!