Open
Description
Describe the bug
When using GitHub Codespaces, it creates a unique subdomain for each port exposed.
If Vite is running in middleware mode (nuxt 3), it attempts to obtain the hostname using the current location. Setting the hostname would fix this client side, but it would cause vite to attempt to bind to the incorrect host on the server side.
Solution:
There needs to be a clientHost, similar to the clientPort option in server.hmr
.
Reproduction
Run vite in middleware mode (using nuxt 3 for example). Create a reverse proxy to the server and one to the hmr server.
System Info
GitHub Codespaces
System:
OS: Linux 5.4 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (4) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
Memory: 3.89 GB / 7.77 GB
Container: Yes
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 16.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/share/npm-global/bin/yarn
npm: 8.5.0 - /usr/local/bin/npm
Used Package Manager
yarn
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.