Deploying Phoenix to Heroku using CloudFlare

I started developing my personal blog (and a basic CMS) using Phoenix.

I successfully deployed it to Heroku following the Documentation/Guides, it’s live.

Now I added my custom domain “jonathansoifer.com” to the Heroku App but everytime I access it, the URL on the browser switches from that custom domain to the “Heroku app URL” (jonathansoifer.herokuapp.com).

Am I missing something?

It might be useful to know that the DNS is being managed by CloudFlare, using CNAME flattening as recommended by CloudFlare itself.

CNAME • jonathansoifer.comjonathansoifer.com.herokudns.com

Looks like everything on the Phoenix end is ok, but your domain settings are incomplete - did you follow the full instructions here: https://devcenter.heroku.com/articles/custom-domains

Sure enough, the issue was within config/prod.exs.

I had hard coded the Heroku URL there in order to take advantage of Heroku’s free SSL when using their subdomains.

1 Like

@jaysoifer To solve this did you just change jonathansoifer.com.herokudns.com to jonathansoifer.com.com in config/prod.exs and left everything else the same?

It’s been a while and I eventually gave up on this project sorry. I do clearly remember that is not what I did at that time…