The vue version is vue3. The axios version is 0.24.0. When I use this method to enable HTTPS, it noticed me that invalid cert.
const axios = require('axios')
const fs = require('fs')
const https = require('https')
import { Notify } from 'quasar';
const httpsAgent = new https.Agent({
ca: fs.readFileSync('xxx.pem')
})
axios.get('https://example.com:9500/xxx', { httpsAgent });
The cert is self-signed cert in PKCS8. And the error msg is
Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID
I'm sure the cert is the server root CA. But is seems does't work in my code. I don't know what's wrong in my code or cert. Maybe need pkcs12 cert? Can somebody answer me. Thank a lot.