proxy-module icon indicating copy to clipboard operation
proxy-module copied to clipboard

socket hang up

Open ahoiroman opened this issue 2 years ago • 2 comments

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.

ahoiroman avatar Jun 08 '22 21:06 ahoiroman

same here

tarikhagustia avatar Nov 30 '22 13:11 tarikhagustia

same here

zc1342303 avatar Jun 10 '23 17:06 zc1342303