Chloe Chloe - 5 months ago 11x
PHP Question

Adding Fastly CDN causes redirects to wrong host in Yii. AKA: Why is my Yii app with custom domain redirecting to

I added Fastly CDN to my site, and now when I try to log into the admin section, it will redirect to instead of I suppose this is because Fastly is requesting the page on the backend with

. Is there a setting in Yii to change the host name in production so it redirects to the correct domain? I tried searching the docs for 'domain' or 'host' but could not find any relevant settings. These were the closest docs I could find.$loginUrl-detail


You have to change the default host, general.default_host, so it uses that when requesting from the back end.

$ curl -X PUT -H $FASTLY_API_KEY "$FASTLY_API_URL/version/3/clone"
# note the new version number
$ curl -X PUT -d "" -H $FASTLY_API_KEY "$FASTLY_API_URL/version/5/settings"
$ curl -X PUT -H $FASTLY_API_KEY "$FASTLY_API_URL/version/5/activate"