Closed bryceandy closed 3 years ago
I had the same problem, it doesn't make sense but I have come up with a simple solution :)
I've created plugins/axios.js
export default function ({ $axios, $toast, store, redirect }) {
$axios.onError((error) => {
// error
})
$axios.onRequest((config) => {
config.url = '<your url>' + config.url
})
}
For example when you send Axios request to "categories/list" it will be "https://domain.com/categories/list"
I know it is simple but now it's working 😄
Hey, Sorry for the late response, do you mind create reproduction sample using template.nuxtjs.org?
You can use workaround from @OFK0
this helped me https://developpaper.com/connect-econnreused-127-0-0-180-exception-resolution/
in package.json
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "80"
}
}
Nuxt version 2.14.7
Axios module 5.12.2
Problem: (Occurring only in production)
asyncData
on a page with middleware and directory structure/dirName/fileName.vue
, the request goes to correct baseURL./dirName/_id/index.vue
the error is shown as in the titleprocess.env.SOME_VARIABLE
does not work on the previous situationCode sample
Page
/inspirations/_id/index.vue
Things I have tried:
into
Nothing changed. The only fix I have now is to hard code the baseURL