Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug]: Every page load of a Vite site waits 15s: dev-server check fails on IPv6 loopback ([::1])

Abierto Apto para principiantes
#1,786 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
laravel, php, vite
Área
backend, devtools

Línea de trabajo

Lee DevServerBoot::devServerServing() y LaravelValetDriver::canConnect() en el controlador de Valet; el issue identifica el manejo del host IPv6 e incluye un comando PHP reproducible con fsockopen. Comprueba cómo viteServesSite() da formato a las URL IPv6 y luego verifica que las solicitudes a un sitio cuyo public/hot contiene http://[::1]:5173 ya no esperan 15 segundos. Se considera terminado cuando la comprobación del servidor de desarrollo tiene éxito y la página reportada carga con fluidez.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

macOS windows
Platform

macOS

Operating system version

macOS 26.6.2

System architecture

ARM64 (M1, M2, etc)

Herd Version

2.0.3

PHP Version

8.5.12

Bug description

Since Herd 2.0, every browser page load of a Laravel site that uses Vite and has no public/build/manifest.json takes about 15 seconds, even though the site's Vite dev server is up and running.

Cause: LaravelValetDriver::ensureViteDevServer() keeps deciding that the dev server is not serving, so it holds the request (BOOT_AND_WAIT) for the full 15s deadline.

  • Vite listens on the IPv6 loopback, so public/hot contains http://[::1]:5173 (the default with Node 17+ on macOS, where localhost resolves to ::1).
  • DevServerBoot::devServerServing() strips the brackets ($host = trim($host, '[]')) and passes ::1 to LaravelValetDriver::canConnect().
  • canConnect() calls fsockopen('::1', 5173, ...). PHP can't resolve a bare IPv6 literal there (getaddrinfo for failed: nodename nor servname provided), so it always returns false. fsockopen('[::1]', 5173) connects fine.
  • So devServerServing() is always false, the poll loop never succeeds, and every request waits until the deadline. The page then renders normally, because Vite really is serving.

For sites that do have a build manifest, the same false negative means every GET gets the BOOT action, so Herd is POSTed /ai/dev-ensure on each page load.

Measurements (same site, same URL, Vite running on [::1]:5173):

Request Time
curl https://site.test/login (Accept */*, so the action is BOOT) 0.07s
curl -H 'Accept: text/html' https://site.test/login (BOOT_AND_WAIT) 15.2s
Same with the AI assistant disabled in herd.json 0.07s

A PHP backtrace taken from the FPM worker during the stall:

#1 usleep() .../valet/cli/Valet/Drivers/LaravelValetDriver.php:145
#2 Valet\Drivers\LaravelValetDriver->ensureViteDevServer() .../LaravelValetDriver.php:32
#3 Valet\Drivers\LaravelValetDriver->beforeLoading() .../valet/server.php:149

Suggested fix: keep the brackets for IPv6 literals when connecting, e.g. in canConnect():

$target = strpos($host, ':') !== false ? '['.$host.']' : $host;
$socket = @fsockopen($target, $port, $errno, $errstr, 0.15);

viteServesSite() already does this for the URL.

Workaround: disable the AI assistant (aiAssistant.enabled: false), which makes ensureViteDevServer() return early. Alternatively, make Vite listen on IPv4 (server.host: '127.0.0.1') so public/hot holds 127.0.0.1.

#1778 (Windows, "too slow after latest update") may be related, though I haven't checked whether this is the cause there.

Steps to reproduce
  1. Herd 2.0.3 on macOS with the AI assistant / Herd Studio enabled (the default).
  2. A Laravel site with vite.config.js and no public/build/manifest.json.
  3. Run npm run dev (or let Herd auto-start Vite). public/hot now contains http://[::1]:5173.
  4. Load any page in the browser, or run curl -H 'Accept: text/html' https://site.test/. Each request takes ~15s.
  5. Check: php -r 'var_dump(@fsockopen("::1", 5173));' gives false, and php -r 'var_dump(@fsockopen("[::1]", 5173));' gives a resource.
Relevant log output
$ cat public/hot
http://[::1]:5173

$ php -r 'foreach (["::1", "[::1]"] as $h) { $s = @fsockopen($h, 5173, $en, $es, 0.15); echo $h, " => ", $s ? "OK" : "FAIL ($es)", PHP_EOL; }'
::1 => FAIL (php_network_getaddresses: getaddrinfo for  failed: nodename nor servname provided, or not known)
[::1] => OK
Lenguaje dominante
Sin datos de lenguaje
Estrellas
124
Forks
1
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de beyondcode/herd-community

Todos los issues de beyondcode/herd-community

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.