On heroku, is there absolutely no way to redirect an https naked domain on heroku to it's non naked domain with wwws? On heroku, is there absolutely no way to redirect an https naked domain on heroku to it's non naked domain with wwws? heroku heroku

On heroku, is there absolutely no way to redirect an https naked domain on heroku to it's non naked domain with wwws?


The best idea we have found so far is to setup two Amazon EC2 micro machine instances with a small bit of nginx configuration. Then, provision two elastic IP addresses to point to those EC2 instances and point 2 A records to those IP addresses. This way, if something goes wrong on the hardware, you can always point your elastic IPs at another EC2 machine without waiting for DNS to propagate. Users going to https://example.com and http://example.com will get a 301 to the domain and no SSL warning.

server {  listen 80;  listen 443 default_server ssl;  server_name example.com;  ssl_certificate server.crt;  ssl_certificate_key server.key;  return 301 https://www.example.com$request_uri;}

Another idea is to use the great service provided by wwwizer.


The best option is to use something like DNSimple's ALIAS record type which provides root-domain support to a CNAME record.

You could then setup your records like so (assuming the use of the SSL Endpoint for SSL).

| type  | name | target                  || ALIAS |      | tokyo-123.herokussl.com || CNAME | www  | tokyo-123.herokussl.com |

Though there are other DNS providers that provide similar ALIAS record functionality (such as DNSMadeEasy's ANAME), it is not something in the DNS spec. This is why we have yet to provide thorough documentation on using such records. However, we aim to rectify this in the near future given the lack of clear guidance for those wanting root domain support.

Keep an eye out on using AWS Route 53 as your Heroku app's DNS as well. I believe it is, or soon will be possible, to accomplish this on R53 soon.


A 301 redirect is the proper way to do it, as the RFC1033 states that you can't point your zone apex (root domain) to a CNAME record - it needs to be an A record.

That being said, there are DNS services out there that offer the possibility to do so anyway. I am yet to try it out myself, but CloudFlare offers a free tier and started offering CNAME for zone apexes last year.