项目开发时,由于服务器只接受https请求,所以在生产环境时,要把所有http请求全都重定向为https,具体操作是在app.js文件里加入以下代码:

var express = require('express');
var toHttps = require('express-to-https').basic;
if(clusterUtility.API.clusterType == "release"){
    //判断只在生产环境使用此插件
    app.use(toHttps);
}

相关文章:

  • 2021-04-20
  • 2022-01-09
  • 2021-11-01
  • 2021-09-19
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2021-10-03
  • 2021-07-08
  • 2021-10-11
相关资源
相似解决方案