From 3eabd3238fd9208932b0ab6656af9d600e07110b Mon Sep 17 00:00:00 2001 From: benya Date: Thu, 2 Apr 2026 23:27:46 +0300 Subject: [PATCH] feat: add single-port reverse proxy deployment support --- .env.example | 2 +- SUBSONIC_SERVER_BLUEPRINT.md | 6 +-- apps/web/src/components/app-shell.tsx | 3 +- apps/web/src/lib/api.ts | 2 +- apps/web/vite.config.ts | 14 +++++ deploy/Caddyfile | 15 ++++++ deploy/Dockerfile | 2 +- deploy/REVERSE_PROXY.md | 77 +++++++++++++++++++++++++++ docker-compose.yml | 11 ++-- internal/config/config.go | 2 +- 10 files changed, 122 insertions(+), 12 deletions(-) create mode 100644 deploy/Caddyfile create mode 100644 deploy/REVERSE_PROXY.md diff --git a/.env.example b/.env.example index 326e6d5..1c5bb89 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ APP_ENV=development SERVER_HOST=0.0.0.0 -SERVER_PORT=4040 +SERVER_PORT=5050 DATABASE_PATH=./data/app.db APP_ENCRYPTION_KEY=change-me-for-production ARTWORK_CACHE_DIR=./data/artwork diff --git a/SUBSONIC_SERVER_BLUEPRINT.md b/SUBSONIC_SERVER_BLUEPRINT.md index 4175219..7dd8005 100644 --- a/SUBSONIC_SERVER_BLUEPRINT.md +++ b/SUBSONIC_SERVER_BLUEPRINT.md @@ -680,9 +680,9 @@ Responsibilities: - [x] Persistent DB volume - [x] Persistent cache volume - [x] Music folder mount strategy -- [ ] Single public HTTPS port for web UI and Subsonic clients -- [ ] Reverse proxy example -- [ ] HTTPS deployment notes +- [x] Single app port for web UI and Subsonic clients +- [x] Reverse proxy example +- [x] HTTP/reverse proxy deployment notes - [ ] Backup/restore notes ## Nice-to-Have After MVP diff --git a/apps/web/src/components/app-shell.tsx b/apps/web/src/components/app-shell.tsx index 3e635fa..dc45a98 100644 --- a/apps/web/src/components/app-shell.tsx +++ b/apps/web/src/components/app-shell.tsx @@ -38,6 +38,7 @@ export function AppShell({ children }: { children: React.ReactNode }) { const username = useSessionStore((state) => state.username) const clearSession = useSessionStore((state) => state.clearSession) const fullPlayerOpen = usePlayerStore((state) => state.fullPlayerOpen) + const currentOrigin = typeof window !== 'undefined' ? window.location.origin : '' const [settingsOpen, setSettingsOpen] = useState(false) const [userMenuOpen, setUserMenuOpen] = useState(false) const [paletteOpen, setPaletteOpen] = useState(false) @@ -87,7 +88,7 @@ export function AppShell({ children }: { children: React.ReactNode }) {
{username ?? 'demo'}
-
https://music.daemonlord.ru
+
{currentOrigin || 'https://music.example.com'}