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

This commit is contained in:
Jason Rasmussen
2025-10-24 14:00:51 -04:00
committed by GitHub
parent c4ff2ea6d5
commit d9cddeb0f1

View File

@@ -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(),