My backend (API endpoints) is running on https://127.0.0.1:8000/api. When that is the case, Nuxt.js is giving the following error:
self signed certificate 18:37:18
at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
at TLSSocket.emit (events.js:182:13)
at TLSSocket.EventEmitter.emit (domain.js:442:20)
at TLSSocket._finishInit (_tls_wrap.js:631:8)
What's the solution to this? I've seen threads that suggest running Nuxt.js in https
mode as well, but all the solutions to do that don't work.
Nuxt.js should provide a simple way to run nuxt in HTTPS
It doesn't
Create file
plugins/axios.js
~~~
import https from 'https';
export default function ({ $axios }) {
$axios.defaults.httpsAgent = new https.Agent({ rejectUnauthorized: false });
}
~~~
Update nuxt.config.js
~
plugins: [
'@/plugins/axios',
],
~
This should fix the issue
Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:
Issues that are labeled as pending
will not be automatically marked as stale.
Most helpful comment
Create file
plugins/axios.js
~~~
import https from 'https';
export default function ({ $axios }) {
$axios.defaults.httpsAgent = new https.Agent({ rejectUnauthorized: false });
}
~~~
Update
nuxt.config.js
~plugins: [
'@/plugins/axios',
],
~
This should fix the issue