📜  强制 https nuxt heroku - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:26.185000             🧑  作者: Mango

代码示例1
// Nuxt @ v2.15.6
// 1. Install redirectSSL
npm i redirect-ssl

// 2. Import package in nuxt.config.js
import redirectSSL from 'redirect-ssl';

// 3. Add redirect to nuxt.config.js (make sure you have environment variables in Heroku)
export default {
   ...
   serverMiddleware: [
     redirectSSL.create({enabled: process.env.NODE_ENV === 'production'})
   ],
   ...
}