-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Description
Describe the bug
If configured with proxy, such as
server.proxy: {
'/api': {target: 'http://localhost:3000/'},
}
Vite won't restart when the local server is restarted, especially when server restart takes more than a few seconds (during development), throwing an error:
19:25:21 [vite] http proxy error:
Error: connect ECONNREFUSED 127.0.0.1:3000
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
Reproduction
n/a
System Info
System:
OS: macOS 12.2
CPU: (8) x64 Apple M1
Memory: 47.80 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.2 - /usr/local/opt/node@16/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 8.5.0 - /usr/local/opt/node@16/bin/npm
Browsers:
Chrome: 101.0.4951.54
Safari: 15.3
npmPackages:
@vitejs/plugin-react: ^1.1.4 => 1.2.0
@vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6
vite: ^2.7.12 => 2.8.6
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
TemaSM, AdelNorberg, NullEnt1ty, ildar-gilmanov and valorloff