13.04.2026
This commit is contained in:
28
panel-dostepu/vite.config.js
Normal file
28
panel-dostepu/vite.config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const haUrl = env.VITE_HA_URL || 'http://10.20.10.106:8123'
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
port: 5173,
|
||||
host: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: haUrl,
|
||||
changeOrigin: true,
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq, req) => {
|
||||
// Upewnij się że Authorization header jest przekazywany
|
||||
const auth = req.headers['authorization']
|
||||
if (auth) proxyReq.setHeader('Authorization', auth)
|
||||
})
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user