-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Hello,
I got a pretty weird problem:
I created this proxy:
axios: {
credentials: true,
proxy: true,
baseURL: process.env.NUXT_PUBLIC_BASE_URL,
debug: process.env.NODE_ENV && process.env.NODE_ENV === 'development',
},
proxy: {
'/backend': {
target: process.env.NUXT_PUBLIC_APP_URL, // http://api.test
changeOrigin: true,
secure: process.env.NODE_ENV && process.env.NODE_ENV === 'development',
credentials: true,
rewrite: (path) => path.replace(/^\/backend/, ''),
common: {
'Accept': 'application/json, text/plain, */*'
},
},
},
```
Now If I do something like:
return useFetch(/backend${url}, {
server: true,
credentials: "include", // Allow browser to handle cookies
headers,
...opts,
pick: pick
});
I get this error:
http proxy error: Error: socket hang up
at connResetException (node:internal/errors:693:14)
at Socket.socketOnEnd (node:_http_client:478:23)
at Socket.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1344:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
timestamp: true,
error: Error: socket hang up
at connResetException (node:internal/errors:693:14)
at Socket.socketOnEnd (node:_http_client:478:23)
at Socket.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1344:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ECONNRESET'
}
}
If I use
return useFetch(http://api.test/${url}, {
server: true,
credentials: "include", // Allow browser to handle cookies
headers,
...opts,
pick: pick
});
everything works like a charm.