Search code examples
reactjsruby-on-railssslherokuhttp-redirect

Redirect from http to https on HEROKU


I have a reactjs frontend server and a backend ruby on rails server. Both of them are hosted on Heroku.

My domain name is on GoDaddy and i am paying a version on Heroku (for my frontend server) to have a ssl (Automated Certificate Management (ACM)).

I can access my domain name on the https protocol but also on the http protocol

I would like to redirect all connections to the website from http to https.

I tried multiple things:

  • Cloudflare but that didn't work out
  • https_only in my static.json of my reactjs server
  • force_ssl=true on my ruby on rails server

Nothing is working.

What are your advice to solve that kind of problems ? I don't know if i should solve that in the reactjs server (no info about that on google) or on godaddy (apparently that is not working with heroku) or on the rails server (i don't think so because it's the backend server)...

I am looking forward to have a better understanding of the DNS thing but it is not easy, have you some tutorial to share with me ?

Thanks in advance


Solution

  • I just use the "Always use HTTPS"-Feature from Cloudflare for that.