Skip to main content Link Search Menu Expand Document (external link)

Axios - Development SSL

During development, you’ll want to add the CA certificate path into your config.

Example

Remember to include this plugin in your nuxt config.

plugins/axios.js

const https = require('https')
const fs = require('fs')

export default function ({ $axios }) {
  if (process.env.NODE_ENV === 'production') return

  const caCrt = fs.readFileSync('/certs/rootCA.pem')
  const httpsAgent = new https.Agent({ ca: caCrt, keepAlive: false })

  $axios.onRequest((config) => {
    config.httpsAgent = httpsAgent
  })
}

Copyright © 2018-2020 Silverback IS. Distributed by an MIT license.