Sails.JS HTTP + HTTPS

后端 未结 8 2247
夕颜
夕颜 2021-01-02 04:49

I am trying to figure out how to lift a sails app that responds to both HTTP and HTTPS requests. I used the config/local.js method of configuring express like so (detailed h

8条回答
  •  無奈伤痛
    2021-01-02 05:40

    I've been wondering for running sailsjs on HTTPS and after going back and forth here is the solution working for me.

    1. I copied .crt and .key file in project directory under ssl folder
    2. config/local.js updated with following as I'm using sailsjs 0.12.3

      
      ssl: {
        key: require('fs').readFileSync(require('path').resolve(__dirname + '/ssl/mykey.key')),
        cert: require('fs').readFileSync(require('path').resolve(__dirname + '/ssl/mycert.crt'))
      }
      
      
      

提交回复
热议问题