Skip to content

Unable to set clientHost in HMR #8666

Open
@alexyao2015

Description

@alexyao2015

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions