diff --git a/README.md b/README.md index 6a5f4d7..d53b3cc 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ A modern, high-performance **SolidJS + TypeScript** web application for the Heza ## 📦 Prerequisites & Setup - **Node.js** 20+ or **bun** (recommended) -- Hezarfen backend running at `http://127.0.0.1:8080` (or proxied via Vite) +- Access to the Hezarfen backend at `https://hezarfen.dizey.sh` ### Installation & Development @@ -51,7 +51,7 @@ bun run build Open [http://localhost:5173](http://localhost:5173) in your browser. -> **Proxy Note**: Vite server automatically proxies `/api/*` and WebSocket connections (`/ws/*`) to `http://127.0.0.1:8080`, preserving HttpOnly session cookies across same-origin calls. +> **Proxy Note**: Vite server and the production Bun server proxy `/api/*` and WebSocket connections to `BACKEND_ORIGIN` (default: `https://hezarfen.dizey.sh`), preserving HttpOnly session cookies across same-origin calls. Override it when needed (`BACKEND_ORIGIN=http://127.0.0.1:7656 bun run dev` or `BACKEND_ORIGIN=http://host.containers.internal:7656 podman compose up -d --build`). --- diff --git a/compose.yaml b/compose.yaml index 951e721..0d220ed 100644 --- a/compose.yaml +++ b/compose.yaml @@ -9,8 +9,8 @@ services: - "5173:5173" environment: PORT: "5173" - # Backend on the shared compose network; server.ts proxies /api here. - BACKEND_ORIGIN: "http://hezarfen-backend:8080" + # Remote backend origin; server.ts keeps browser traffic same-origin. + BACKEND_ORIGIN: "${BACKEND_ORIGIN:-https://hezarfen.dizey.sh}" restart: unless-stopped healthcheck: # Bun-based: the slim runtime image ships no curl. @@ -19,9 +19,3 @@ services: timeout: 5s retries: 3 start_period: 10s - networks: - - hezarfen_backend_default - -networks: - hezarfen_backend_default: - external: true diff --git a/server.ts b/server.ts index ef4f080..8020897 100644 --- a/server.ts +++ b/server.ts @@ -8,7 +8,7 @@ const PORT = Number(Bun.env.PORT ?? 5173); // Where the backend lives on the compose network. Override in compose. -const BACKEND_ORIGIN = Bun.env.BACKEND_ORIGIN ?? "http://127.0.0.1:8080"; +const BACKEND_ORIGIN = Bun.env.BACKEND_ORIGIN ?? "https://hezarfen.dizey.sh"; const BACKEND_HTTP = BACKEND_ORIGIN.replace(/\/+$/, ""); const BACKEND_WS = BACKEND_HTTP.replace(/^http/, "ws"); const BACKEND_HOST = new URL(BACKEND_HTTP).host; diff --git a/vite.config.ts b/vite.config.ts index 349657f..92c4a9e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,7 @@ import path from "node:path"; import { defineConfig } from "vite"; import solid from "vite-plugin-solid"; -const target = "http://127.0.0.1:8080"; +const target = process.env.BACKEND_ORIGIN ?? "https://hezarfen.dizey.sh"; export default defineConfig({ plugins: [solid()],