Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket hang up #113

Open
ahoiroman opened this issue Jun 8, 2022 · 2 comments
Open

socket hang up #113

ahoiroman opened this issue Jun 8, 2022 · 2 comments

Comments

@ahoiroman
Copy link

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.
@tarikhagustia
Copy link

same here

1 similar comment
@zc1342303
Copy link

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants