mirror of
https://github.com/immich-app/immich.git
synced 2025-11-01 02:57:08 -04:00
chore: use reverse proxy during local preview (#23184)
This commit is contained in:
parent
c4ff2ea6d5
commit
d9cddeb0f1
@ -4,7 +4,7 @@ import tailwindcss from '@tailwindcss/vite';
|
|||||||
import { svelteTesting } from '@testing-library/svelte/vite';
|
import { svelteTesting } from '@testing-library/svelte/vite';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
import { defineConfig, type UserConfig } from 'vite';
|
import { defineConfig, type ProxyOptions, type UserConfig } from 'vite';
|
||||||
|
|
||||||
const upstream = {
|
const upstream = {
|
||||||
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:2283/',
|
target: process.env.IMMICH_SERVER_URL || 'http://immich-server:2283/',
|
||||||
@ -14,6 +14,12 @@ const upstream = {
|
|||||||
ws: true,
|
ws: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const proxy: Record<string, string | ProxyOptions> = {
|
||||||
|
'/api': upstream,
|
||||||
|
'/.well-known/immich': upstream,
|
||||||
|
'/custom.css': upstream,
|
||||||
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
target: 'es2022',
|
target: 'es2022',
|
||||||
@ -28,13 +34,12 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
// connect to a remote backend during web-only development
|
// connect to a remote backend during web-only development
|
||||||
proxy: {
|
proxy,
|
||||||
'/api': upstream,
|
|
||||||
'/.well-known/immich': upstream,
|
|
||||||
'/custom.css': upstream,
|
|
||||||
},
|
|
||||||
allowedHosts: true,
|
allowedHosts: true,
|
||||||
},
|
},
|
||||||
|
preview: {
|
||||||
|
proxy,
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
enhancedImages(),
|
enhancedImages(),
|
||||||
tailwindcss(),
|
tailwindcss(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user