fix(api): cookies not set on http connections

Frontend uses .env URL.
This commit is contained in:
2026-06-26 14:47:15 +01:00
parent 0b2c875889
commit 85ddd93757
3 changed files with 33 additions and 26 deletions

View File

@@ -1,27 +1,30 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import flowbiteReact from "flowbite-react/plugin/vite";
export default defineConfig(({ mode }) => { // change to function form
const env = loadEnv(mode, process.cwd(), '') // load all env vars
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss(), flowbiteReact()],
preview: {
port: 5173,
strictPort: true,
},
server: {
port: 5173,
strictPort: true,
host: true,
origin: "http://0.0.0.0:5173",
proxy: {
'/api/v1': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
return {
plugins: [react(), tailwindcss(), flowbiteReact()],
preview: {
port: 5173,
strictPort: true,
},
server: {
port: 5173,
strictPort: true,
host: true,
origin: env.VITE_FRONTEND_URL || "http://0.0.0.0:5173", // use it here
allowedHosts: true,
proxy: {
'/api/v1': {
target: 'http://localhost:8080',
changeOrigin: true,
secure: false,
}
}
}
}
})
})