Skip to content

High performance self-hosted photo and video management solution.

chore: use reverse proxy during local preview (#23184)

Jason Rasmussend9cddeb0f180
diff --git a/web/vite.config.ts b/web/vite.config.ts
index b44d1c0078..6a2f34cf55 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -4,7 +4,7 @@ import tailwindcss from '@tailwindcss/vite';
import { svelteTesting } from '@testing-library/svelte/vite';
import path from 'node:path';
import { visualizer } from 'rollup-plugin-visualizer';
-import { defineConfig, type UserConfig } from 'vite';
+import { defineConfig, type ProxyOptions, type UserConfig } from 'vite';
const upstream = {
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:2283/',
@@ -14,6 +14,12 @@ const upstream = {
ws: true,
};
+const proxy: Record<string, string | ProxyOptions> = {
+ '/api': upstream,
+ '/.well-known/immich': upstream,
+ '/custom.css': upstream,
+};
+
export default defineConfig({
build: {
target: 'es2022',
@@ -28,13 +34,12 @@ export default defineConfig({
},
server: {
// connect to a remote backend during web-only development
- proxy: {
- '/api': upstream,
- '/.well-known/immich': upstream,
- '/custom.css': upstream,
- },
+ proxy,
allowedHosts: true,
},
+ preview: {
+ proxy,
+ },
plugins: [
enhancedImages(),
tailwindcss(),