Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

force https nuxt heroku

// 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'})
   ],
   ...
}
 
PREVIOUS NEXT
Tagged: #force #https #nuxt #heroku
ADD COMMENT
Topic
Name
1+7 =