Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

1and1 domain name redirect HTTP or Frame with Heroku host?

So I purchased a domain from 1and1, say it's www.mysite.com, and am hosting my app on Heroku myapp.herokuapp.com. I have two options for forwarding the domain - HTTP and Frame. HTTP forwarding seems to just redirect my URL from www.mysite.com to myapp.herokuapp.com, which isn't what I want. But I am having a problem with Frame redirecting - if I navigate on my site to various pages (e.g. myapp.herokuapp.com/users), it will still say www.mysite.com on the top, but not www.mysite.com/users. How can I get the URL path to display correctly?

like image 683
Kvass Avatar asked Jul 18 '12 04:07

Kvass


People also ask

How do I redirect a non www Heroku?

Go to the record editor and two DNS records, one for each host name, pointing to the Heroku SSL endpoint: Add an ALIAS record to point example.com to Heroku. Leave the Name of the record empty and set the Content field to the SSL endpoint example.com.herokudns.com. Add a CNAME record to point www.example.com to Heroku.


1 Answers

You don't want to use the (i)frame method - it's bad practice and you'll get the issues you're having now.

What you probably want to do is:

  1. Attach www.yourdomain.com to your Heroku app (via the web interface or the CLI[1])
  2. Set up a CNAME record to point www to yourapp.herokuapp.com with your DNS provider, or use the Zerigo DNS[2] add-on if you don't have DNS hosting already (sounds like you do)
  3. (Optional) Set up a re-direct to direct http://yourdomain.com to http://www.yourdomain.com, via your DNS provider/domain registrar - this is optional, but useful as Heroku does not recommend pointing your root domain (yourdomain.com) to their A records in case they change.
  4. (Optional) Re-direct http://myapp.herokuapp.com/ to http://www.yourdomain.com/ from within your application code or similar (e.g. config.ru if you're using Rack to serve your content)

[1] https://devcenter.heroku.com/articles/custom-domains [2] https://addons.heroku.com/zerigo_dns

like image 103
elithrar Avatar answered Sep 28 '22 10:09

elithrar