Vite: allow tailnet hostnames so dev overlay can serve via reverse proxy #117
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-app#117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Discovered while bringing up the new
pal-e-devdev overlay (ldraney/pal-e-deployments#151 / PR #152). When traffic fromhttps://pal-e-dev.tail5b443a.ts.netreached Vite via the Tailscale ingress + Service, Vite returned HTTP 403 because the unfamiliarHostheader isn't inserver.allowedHosts. Same blocker will hit any future dev overlay (*-dev.tail5b443a.ts.net).Already applied locally on branch
iterate-2026-05-04and verified working — this PR commits the fix to main.Repo
ldraney/pal-e-appUser Story
As Lucas (developer)
I want Vite to accept any
*.tail5b443a.ts.netHost headerSo that any dev overlay funnel hostname works without a config change per overlay
Context
Vite 6 ships with a stricter
server.allowedHostsdefault than older versions: it only allowslocalhostand the bind-address Host. Any reverse-proxy (k8s ingress, Tailscale funnel, etc) appears to Vite as an unknown host and gets 403'd. This is invisible during local dev (where Host always matches localhost) but breaks the moment Vite sits behind a proxy — exactly our dev overlay pattern.Direct verification 2026-05-05:
curl -H "Host: pal-e-dev.tail5b443a.ts.net" http://<pod-ip>:5173/returnedHTTP/1.1 403 Forbidden, whilewget http://localhost:5173/from inside the pod returned proper SvelteKit HTML. Confirms the 403 originates inside Vite.File Targets
Files to modify:
vite.config.ts-- addserver: { allowedHosts: ['.tail5b443a.ts.net'] }(leading dot wildcards subdomains)Files to NOT touch:
package.json-- vitest is already declared; no dep changes neededAcceptance Criteria
vite.config.tsincludesserver.allowedHostsallowing.tail5b443a.ts.netcurl -H "Host: pal-e-dev.tail5b443a.ts.net" http://<pod-ip>:5173/returns 200 with HTMLhttps://pal-e-dev.tail5b443a.ts.net/loads the SvelteKit appnpm run build) still succeeds —allowedHostsis dev-onlyTest Expectations
kubectl -n pal-e-app delete pod -l app=pal-e-app-devthencurl -sI https://pal-e-dev.tail5b443a.ts.net/returns 200+page.svelteafter fix, change appears via dev URL in <2sConstraints
.tail5b443a.ts.net) so all current and future dev overlays inherit the allowance — avoids per-overlay config driftallowedHosts: true(that would allow anything, including DNS rebinding attacks against any local Vite)Checklist
Related
ldraney/pal-e-deployments #151-- the dev overlay that surfaced thisldraney/pal-e-deployments #153-- the parallel CORS fix on the backend (just merged)pal-e-app-- the project this fixes