Home > Enterprise >  How to change the http into https for my domain name?
How to change the http into https for my domain name?

Time:10-29

I recently bought a domain name at OVH for an app I hosted on Heroku. I then paid for the dynos in order to set an automatic SSL certificate.

Everything seems to me working fine:

Domain       Status       Last Updated
───────────  ───────────  ────────────
mpjrigot.eu  Cert issued  2 minutes
mpjrigot.fr  Cert issued  2 minutes

But my URL is still in HTTP. What am I missing?

EDIT

I'm using React.js for this ass I also have a Ruby on Rails back but for nom i'm keeping that on the heroku.app, works fine

CodePudding user response:

You can add HTTPS to your app with the following methods.

Method1 (Recommended)

Since, you're using rails for the backend, you can configure your rails app to always use HTTPS.

in your production.rb add

config.force_ssl = true

Method2 (Easy Setup)

You can also signup for cloudflare's free plan and easily setup https redirects with cloudflare's 'Always Use HTTPS' or 'Automatic HTTPS Rewrites' feature.

The 'Always Use HTTPS' feature will redirect all http requests on your site to https address.

The 'Automatic HTTP Rewrites' feature will change the HTTP links on your site to HTTPS links.

More Info here:

cloudflare dashboard

CodePudding user response:

What am I missing?

Heroku provides a certificate, so you should be able to access your application using https://. However it does not redirect HTTP requests to HTTPS for you:

Redirects need to be performed at the application level as the Heroku router does not provide this functionality. You should code the redirect logic into your application.

Exactly how you do that depends on the language and libraries or framework that you are using. Several common examples are listed in the link I provided above.

If you edit your question to tell us what technology you have used to build your application I'll be happy to add those details to this answer. In case you are using Scala, please see How to disable HTTP requests on Heroku and/or auto-redirect to HTTPS?

  • Related