Skip to content

fix(web): set changeOrigin on dev proxy targets#76

Merged
cafca merged 1 commit into
mainfrom
feat/vite-proxy-https-changeorigin
May 7, 2026
Merged

fix(web): set changeOrigin on dev proxy targets#76
cafca merged 1 commit into
mainfrom
feat/vite-proxy-https-changeorigin

Conversation

@cafca
Copy link
Copy Markdown
Owner

@cafca cafca commented Apr 27, 2026

Summary

Switch the Vite dev-server proxy entries to long-form config with changeOrigin: true (and secure: false for self-signed cases).

This is required when running the dev server against an HTTPS upstream — e.g.

VITE_API_PROXY_TARGET=https://beebeebike.com \
VITE_TILES_PROXY_TARGET=https://beebeebike.com/tiles \
npm run dev

Without changeOrigin, the proxy forwards Host: localhost:<port> upstream, which Cloudflare / nginx in front of beebeebike.com rejects. With it, the Host header matches the target and requests succeed.

No effect on the default localhost compose setup — both proxies still point at the in-stack services when the env vars are unset.

Test plan

  • npm run dev against localhost compose: /api and /tiles still proxy correctly.
  • VITE_API_PROXY_TARGET=https://beebeebike.com VITE_TILES_PROXY_TARGET=https://beebeebike.com/tiles npm run dev: /api/auth/me returns 401 (auth proxy reachable), /tiles/ returns 200.

Use the long-form Vite proxy config so the upstream Host header reflects
the target instead of the local dev origin. Required when pointing
VITE_API_PROXY_TARGET / VITE_TILES_PROXY_TARGET at https endpoints
(e.g. beebeebike.com) where the upstream rejects mismatched hosts.
@cafca cafca marked this pull request as ready for review May 7, 2026 16:55
@cafca cafca merged commit 9c05a76 into main May 7, 2026
7 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant