快速添加到Heroku应用程序不会转发到正确的URL [英] Adding Fastly to a Heroku app does not forward to proper url
问题描述
我目前有一个通过CDN投放的Heroku应用.我刚刚将Fastly作为插件添加到我的Heroku应用程序中,并且正在努力正确配置它.这是我当前的配置:
I currently have an Heroku app that is being served over a CDN. I have just added Fastly to my Heroku app as an addon and I am struggling to configure it properly. Here is my current configuration:
我使用以下CNAME配置在GoDaddy上注册了我的域:
I have my domain registered on GoDaddy with the following CNAME configuration:
Host: www
Points to: my-site-herokuapp-com.global.ssl.fastly.net
TTL: Custom
Seconds: 600
这是GoDaddy转发配置(不确定是否重要):
Here is the GoDaddy forwarding configuration (not sure if this matters):
Forward to https://www.my-site.io/
(301 & forward only)
这是我的快速配置:
Domains:
my-site-herokuapp-com.global.ssl.fastly.net
*Provisioned for my-site via Heroku*
my-site.herokuapp.com
*Provisioned for my-site via Heroku*
www.my-site.io
最后在Heroku的我的应用程序的域配置"部分中,是我的设置:
And finally in Heroku in the domains configuration section of my app here are my settings:
Domain Name: my-site.io
DNS target: darwinian-kumquat-123456.herokudns.com
Domain Name: www.my-site.io
DNS target: serene-trout-123456.herokudns.com
在尝试进行此更改之前,我先将CNAME指向: serene-trout-123456.herokudns.com
,它工作正常.但是,在将该值更新为新的Fastly值之后: my-site-herokuapp-com.global.ssl.fastly.net
将站点快速定向到 my-site.herokuapp.com 代码>,而不只是
https://www.my-site.io
.我按照此处中列出的说明进行操作,因此不能完全确定我哪里出错了.有什么想法吗?
Before I tried to make this change I had the CNAME pointing directly to: serene-trout-123456.herokudns.com
an it was working fine. However after updating this value to the new Fastly value: my-site-herokuapp-com.global.ssl.fastly.net
Fastly directs the site to my-site.herokuapp.com
instead of just https://www.my-site.io
. I followed the instructions listed here so not entirely sure where I have gone wrong. Any ideas?
推荐答案
可能是因为您使用了重定向301,并且正在使用与以前相同的浏览器,然后才清除缓存和数据.
Probably because you used redirect 301 and you are using the same browser as before before cleaning cache and data.
仅在非常有限的情况下建议使用301重定向:完成后,浏览器将不会再次刷新原始服务器中的任何数据.
301 redirects are recomended only for very limited cases: once done the browsers will NOT refresh again any data from the original server.
关于重定向301的帖子很多,例如:
There are plenty of posts regarding redirection 301, for example:
https://www.exai.com/blog/301-redirects
这篇关于快速添加到Heroku应用程序不会转发到正确的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!