Adding Fastly to a Heroku app does not forward to proper url

爷,独闯天下 提交于 2021-02-10 06:40:48

问题


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:

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

Here is the GoDaddy forwarding configuration (not sure if this matters):

Forward to https://www.my-site.io/
(301 & forward only)

Here is my fastly configuration:

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

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

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?


回答1:


Probably because you used redirect 301 and you are using the same browser as before before cleaning cache and data.

301 redirects are recomended only for very limited cases: once done the browsers will NOT refresh again any data from the original server.

There are plenty of posts regarding redirection 301, for example:

Cannot remove 301 redirect

htaccess 301 redirect - how to disable it?

https://www.exai.com/blog/301-redirects



来源:https://stackoverflow.com/questions/64090734/adding-fastly-to-a-heroku-app-does-not-forward-to-proper-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!