Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with the vite dev server #48

Open
DeluxeOwl opened this issue Feb 23, 2025 · 1 comment · May be fixed by #49
Open

Doesn't work with the vite dev server #48

DeluxeOwl opened this issue Feb 23, 2025 · 1 comment · May be fixed by #49
Assignees
Labels
bug something isn't working docs related to the documentation server related to the server / core logic

Comments

@DeluxeOwl
Copy link

DeluxeOwl commented Feb 23, 2025

This is a barebones vite project and localias install.

❯ bun create vite
✔ Project name: … repro
✔ Select a framework: › React
✔ Select a variant: › TypeScript

Scaffolding project in /private/tmp/A2D5DA12/repro...

Done. Now run:

  cd repro
  bun install
  bun run dev

❯ bun run dev
$ vite
  VITE v6.1.1  ready in 96 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

in another terminal, running and trying curl https://frontend.local/ or going from the browser

❯ localias set frontend.local 5173
[added] frontend.local -> 5173
❯ localias list
frontend.local -> 5173
❯ localias run
2025/02/23 18:07:07.942 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2025/02/23 18:07:07.942 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0x14000701b00"}
2025/02/23 18:07:07.945 INFO    http.auto_https server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv1", "https_port": 443}
2025/02/23 18:07:07.945 INFO    http.auto_https enabling automatic HTTP->HTTPS redirects        {"server_name": "srv1"}
2025/02/23 18:07:07.948 INFO    pki.ca.local    root certificate is already trusted by system   {"path": "storage:pki/authorities/local/root.crt"}
2025/02/23 18:07:07.948 INFO    http.log        server running  {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2025/02/23 18:07:07.948 INFO    http    enabling HTTP/3 listener        {"addr": ":443"}
2025/02/23 18:07:07.948 INFO    http.log        server running  {"name": "srv1", "protocols": ["h1", "h2", "h3"]}
2025/02/23 18:07:07.948 INFO    http.log        server running  {"name": "remaining_auto_https_redirects", "protocols": ["h1", "h2", "h3"]}
2025/02/23 18:07:07.948 INFO    http    enabling automatic TLS certificate management   {"domains": ["frontend.local"]}
mDNS: serving frontend.local (192.168.0.23,100.116.198.42,::1,127.0.0.1)
2025/02/23 18:07:07.956 WARN    tls     storage cleaning happened too recently; skipping for now        {"storage": "FileStorage:/Users/andreisurugiu/Library/Application Support/localias/caddy", "instance": "438e326f-5e8e-4ac3-a6c7-dad358fb9c48", "try_again": "2025/02/24 18:07:07.956", "try_again_in": 86399.999999334}
2025/02/23 18:07:07.957 INFO    tls     finished cleaning storage units
2025/02/23 18:07:11.037 ERROR   http.log.error  dial tcp :5173: connect: connection refused     {"request": {"remote_ip": "::1", "remote_port": "56582", "client_ip": "::1", "proto": "HTTP/2.0", "method": "GET", "host": "frontend.local", "uri": "/", "headers": {"Sec-Fetch-Dest": ["document"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"], "Accept-Language": ["en-US,en-GB;q=0.7,en;q=0.3"], "Upgrade-Insecure-Requests": ["1"], "Te": ["trailers"], "Accept-Encoding": ["gzip, deflate, br, zstd"], "Dnt": ["1"], "Priority": ["u=0, i"]}, "tls": {"resumed": false, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "frontend.local"}}, "duration": 0.000535083, "status": 502, "err_id": "16bm752ak", "err_trace": "reverseproxy.statusError (reverseproxy.go:1267)"}
❯ sudo lsof -i -P
node      86519  andreisurugiu   15u  IPv6 0x526d0cb08487aec8      0t0    TCP localhost:5173 (LISTEN)
node      86519  andreisurugiu   44u  IPv6 0x98bb569cf9be2679      0t0    TCP localhost:5173->localhost:56116 (ESTABLISHED)
localias  86996  andreisurugiu    8u  IPv4 0x958b4af891d35101      0t0    TCP localhost:2019 (LISTEN)
localias  86996  andreisurugiu    9u  IPv4 0x3c7441e340bac943      0t0    TCP localhost:2019 (LISTEN)
localias  86996  andreisurugiu   10u  IPv6 0xae8fd2e3e8fa790b      0t0    TCP *:443 (LISTEN)
localias  86996  andreisurugiu   11u  IPv6 0x491a4331e5f2dbfe      0t0    TCP localhost:2019 (LISTEN)
localias  86996  andreisurugiu   13u  IPv6 0xad90a49261187d4b      0t0    UDP *:443
localias  86996  andreisurugiu   14u  IPv6 0x4dacf43a143cb6a6      0t0    TCP *:80 (LISTEN)
localias  86996  andreisurugiu   15u  IPv4 0xb3b7786e15b0ae95      0t0    UDP *:5353

Any ideas?

Note: I found that it works with bun dev --host and setting allowedHosts in vite, but I have no clue why it doesnt work with localhost

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vite.dev/config/
export default defineConfig({
	plugins: [react()],
	server: {
		allowedHosts: ["frontend.local"],
	},
});
@peterldowns peterldowns linked a pull request Feb 24, 2025 that will close this issue
2 tasks
@peterldowns
Copy link
Owner

Thanks for writing in — I have a draft PR open to fix this (I think), but I need to do a little more testing and writing before I can merge it.

@peterldowns peterldowns self-assigned this Feb 24, 2025
@peterldowns peterldowns added bug something isn't working docs related to the documentation server related to the server / core logic labels Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working docs related to the documentation server related to the server / core logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants