Vite.config configures the Proxy server to solve the cross-domain Session consistency when the Rest API accesses the SpringBoot interface.
import { defineConfig, loadEnv } from 'vite'
export default defineConfig({
server: {
proxy: {
'/rest': {
target: loadEnv('', process.cwd()).VITE_API_URL,
changeOrigin: true
}
}
},
Before agency
JSESSIONID=DA97DE3807A569A2F5524E8834434086; Path=/; HttpOnly
JSESSIONID=08433F457E2AA361D9E01391DEB56A3A; Path=/; HttpOnly
After agency
JSESSIONID=0DD0C41655082C91F91A3FCD2F8550AA
JSESSIONID=0DD0C41655082C91F91A3FCD2F8550AA