Why is the user domain redirected to herokuapp.com?

According to this Heroku documentation , we can allow access to the Heroku application hosted at myapp.herokuapp.com with the custom domain myapp.com .

I added the following entries to my GoDaddy DNS zone file:

 A (Host) Host Points To TTL -------------------------------------------------- @ 50.63.202.1 1/2 Hour CName (Alias) Host Points To TTL -------------------------------------------------- email email.secureserver.net 1/2 Hour ftp @ 1/2 Hour www myapp.herokuapp.com 1/2 Hour 

Typically, entry A points to the server. In this case, Heroku does not provide an IP address for its cloud applications, and CNAME seems to be enough.

Going to www.myapp.com or myapp.com redirects to https://myapp.herokuapp.com . However, switching to http://www.myapp.com/blog/post/1 (any address, not the home page) will remain with the domain www.myapp.com , and clicking links will be OK. myapp.herokuapp.com you click on the link to the home page, we will be redirected to myapp.herokuapp.com .

How to configure it so that the visitor does not see the herokuapp.com address if you do not visit it with this address?

Output of heroku --tail --app myapp logs:

 2016-03-11T01:13:49.756887+00:00 heroku[router]: at=info method=GET path="/" host=vast-hamlet-33090.herokuapp.com request_id=6177aa6c-dc5f-4de5-a1c6-1ff8b1194849 fwd="24.17.117.236" dyno=web.1 connect=1ms service=24ms status=304 bytes=181 2016-03-11T01:13:49.760014+00:00 app[web.1]: 24.17.117.236 - - [11/Mar/2016:01:13:49 +0000] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36" 

It looks like the application never receives a request from www.myapp.com, but only myapp.herokuapp.com.

The output of heroku -a myapp domains:

 === myapp Heroku Domain myapp.herokuapp.com === myapp Custom Domains Domain Name DNS Target ------------------ ------------------- www.myapp.com myapp.herokuapp.com myapp.com myapp.herokuapp.com 
+5
source share
1 answer

In my case, using Ghost, updating HEROKU_URL in the Ghost configuration to " http://www.myapp.com " fixed this error. I thought I had this configured, but I changed it to " http://myapp.herokuapp.com " to access the admin panel, which did not accept requests from URLs, not from HEROKU_URL.

I also had a separate issue with Chrome that automatically redirected the service, not the service, before the request got to the server, so the Node application received a request for myapp.herokuapp.com. I discovered this while trying to use a different browser to access my application. I cleared the cookies and browser cache, and myapp.com was no longer redirected to Chrome.

+7
source

Source: https://habr.com/ru/post/1244713/


All Articles