Search code examples
herokuhttps

Force my heroku app to use SSL (https)


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


Solution

  • You need to add to the Node.js app the code to redirect the request to the HTTPS version if the request comes from HTTP.

    Depending on the framework or the tools you use, the idea is simple:

    • check the request scheme
    • if http, redirect to https passing along the same request uri and query