Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force my heroku app to use SSL (https)

Tags:

https

heroku

I have a node app running successfully on Heroku. I have purchased an Expedited SSL certificate and it all works fine. I go to https... and get a full 'green bar' proving the site is being served over https

However, the non-SSL standard http is still available too. How can I force the app to serve over https? Thanks

like image 210
Zuriar Avatar asked Jan 18 '16 18:01

Zuriar


People also ask

How do I force https on Heroku app?

react-boilerplate can enforce https(redirect http to https) on heroku deployed apps(that has extra layer like cloudflare). var sslRedirect = require('heroku-ssl-redirect');const app = express();app. use(sslRedirect()); Now you get all connection to be on https.

Does Heroku use https by default?

herokuapp.com SSL certificate. No special configuration is needed, just access the app with https and you're secure by default.

How do I enable SSL on Heroku?

Configuring SSL In Heroku, go back to the Settings tab of your application and scroll down to Domain and certificates. You should now see a white button Configure SSL. Click on it. Leave the Automatically option ticked and click on Continue.


2 Answers

On Heroku, it's slightly tricky to determine the fact that the request came in over http. https is handled at a heroku routing layer and it passes along the request to the node app on http).

This post got me unstuck http://jaketrent.com/post/https-redirect-node-heroku/

like image 188
Boon Avatar answered Sep 23 '22 09:09

Boon


There's also NPM module heroku-ssl-redirect helping you to deal with it

like image 29
Dmitry Yudakov Avatar answered Sep 23 '22 09:09

Dmitry Yudakov