From 896684b6f8babd60f04650d85183686f284fb008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Thu, 17 Sep 2026 22:14:17 +0300 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=94=8C=20point=20the=20dev=20pro?= =?UTF-8?q?xy=20at=20the=20public=20backend=20by=20default=20-=20`bun=20ru?= =?UTF-8?q?n=20dev`=20now=20works=20without=20a=20local=20Rust=20backend;?= =?UTF-8?q?=20opt=20into=20one=20with=20=20=20BACKEND=5FORIGIN=3Dhttp://12?= =?UTF-8?q?7.0.0.1:7656=20-=20keep=20stripping=20/api=20for=20direct=20bac?= =?UTF-8?q?kends=20and=20leave=20it=20alone=20for=20the=20public=20=20=20f?= =?UTF-8?q?rontend=20origin,=20which=20terminates=20/api=20itself?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index da8f42c..2ee492f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,11 @@ import path from "node:path"; import { defineConfig } from "vite"; import solid from "vite-plugin-solid"; -const target = process.env.BACKEND_ORIGIN ?? "http://127.0.0.1:7656"; +// Keep zero-config local development usable even when the Rust backend is not +// running on this machine. Deployments use server.ts and the image-level +// BACKEND_ORIGIN instead; developers can still opt into a local backend with +// BACKEND_ORIGIN=http://127.0.0.1:7656 bun run dev. +const target = process.env.BACKEND_ORIGIN ?? "https://hezarfen-backend.dizey.sh"; export default defineConfig({ plugins: [solid()], @@ -27,10 +31,9 @@ export default defineConfig({ target, changeOrigin: true, ws: true, - // Local Rust backend (e.g. :7656) speaks unprefixed routes, so strip - // /api. The public origin terminates /api itself — stripping there - // hits the SPA HTML instead of the API and breaks every local session - // against the default BACKEND_ORIGIN. + // Direct backends (local or public) speak unprefixed routes, so strip + // /api. The public frontend origin terminates /api itself — stripping + // there hits the SPA HTML instead of the API. rewrite: (path) => { try { if (/hezarfen\.dizey\.sh$/i.test(new URL(target).host)) return path;