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

ETIMEDOUT on macos #710

Open
2 tasks done
tinystorm opened this issue Feb 14, 2022 · 8 comments
Open
2 tasks done

ETIMEDOUT on macos #710

tinystorm opened this issue Feb 14, 2022 · 8 comments

Comments

@tinystorm
Copy link

tinystorm commented Feb 14, 2022

Checks

Describe the bug (be clear and concise)

About half of the http and ws requests can not be proxy with such message
' Error occurred while trying to proxy request xxx from xxx to xxx (ETIMEDOUT) '

Yet my workmates using windows did not have such problem.

And Weirdly, When I using LAN and add headers: { 'Connection': 'keep-alive' } in config options,The problem gone!
When I using WIFI or remove the headers config, Problem returns.
It likes that http-proxy-middleware does not add headers when proxy the request

Step-by-step reproduction instructions

1. Using Macos 12.2.1 and Node 16.6.2
2. Proxy the http request and ws request in any project

Expected behavior (be clear and concise)

All the http and ws requests should be proxy successfully.

How is http-proxy-middleware used in your project?

meng@wangmengdeMacBook-Pro frontend % npm ls http-proxy-miidleware
frontend@0.0.0 /Users/meng/IdeaProjects/manager/frontend
└── (empty)

What http-proxy-middleware configuration are you using?

module.exports = function (app) {
  app.use(createProxyMiddleware('/stomp', {
    target: backendAddr,
    ws: true,
    onProxyReqWs: (proxyReq, req, socket) => {
      socket.on('error', function (error) {
        console.warn('Websockets error.', error)
      })
    }
  }))
  app.use(createProxyMiddleware(['/api', '/pub'], {
    target: backendAddr,
    changeOrigin: true,
  }))
}

What OS/version and node/version are you seeing the problem?

System:
    OS: macOS 12.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 2.30 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.6.2 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 7.20.3 - /usr/local/bin/npm
  Managers:
    Gradle: 7.0.1 - /usr/local/bin/gradle
    Homebrew: 3.1.7 - /usr/local/bin/brew
    pip3: 19.2.3 - /usr/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.24.3 - /usr/bin/git
    Clang: 12.0.0 - /usr/bin/clang
  Servers:
    Apache: 2.4.51 - /usr/sbin/apachectl
  IDEs:
    Nano: 2.0.6 - /usr/bin/nano
    Vim: 8.2 - /usr/bin/vim
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 11.0.11 - /usr/bin/javac
    Perl: 5.30.3 - /usr/bin/perl
    Python: 2.7.18 - /usr/bin/python
    Python3: 3.8.2 - /usr/bin/python3
    Ruby: 2.6.8 - /usr/bin/ruby
  Databases:
    SQLite: 3.36.0 - /usr/bin/sqlite3
  Browsers:
    Chrome: 98.0.4758.80
    Safari: 15.3

Additional context (optional)

No response

@tinystorm
Copy link
Author

And I try to sniffer http packets from my node-server-ip to real-server-ip.
According the packets, the request that proxy by http-proxy-middleware connection header is closed.

无标题

@tinystorm tinystorm reopened this Feb 14, 2022
@chimurai
Copy link
Owner

Could you try on a different Mac?

@tinystorm
Copy link
Author

Same problem.
I searched the 'etimedout in mac' in node.js issues and got some similar problems.
I wonder if it is node.js's problem?

@chimurai
Copy link
Owner

You could try it with different node versions to see if that's the case

@samelm
Copy link

samelm commented Jul 12, 2022

Same problem.
It is solved by switching only to mobile hotspot.
But through wifi I often get timeout error.
Using http-proxy-middleware@2.0.6 in webpack-dev-server

@cander0815

This comment was marked as spam.

@tinystorm
Copy link
Author

Not helped.
I am so troubled with it .
Even in vite, I got same issue.

@rayzang8
Copy link

rayzang8 commented Mar 20, 2023

@tinystorm > Not helped. I am so troubled with it . Even in vite, I got same issue.

not to proxy socket.io, then replace the https: true with ca files , would improve this problem

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

No branches or pull requests

5 participants