Skip to content

ETIMEDOUT on macos #710

Open
Open
@tinystorm

Description

@tinystorm

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
[email protected] /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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions