Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top