Force my heroku app to use SSL (https)

前端 未结 9 1176
栀梦
栀梦 2020-11-30 03:42

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

9条回答
  •  星月不相逢
    2020-11-30 04:09

    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

提交回复
热议问题