mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
25 lines
751 B
TypeScript
25 lines
751 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
proxy: {
|
|
// We'll proxy any request that starts with '/api-cnb'
|
|
'/api-cnb': {
|
|
// This is the real API server we want to talk to
|
|
target: 'https://api.cnb.cz',
|
|
|
|
// This is crucial: it changes the 'Origin' header
|
|
// to match the target, so the CNB server is happy.
|
|
changeOrigin: true,
|
|
|
|
// This rewrites the request path. It removes the '/api-cnb' part
|
|
// so the CNB server gets the correct path ('/cnbapi/exrates/daily...').
|
|
rewrite: (path) => path.replace(/^\/api-cnb/, ''),
|
|
},
|
|
},
|
|
},
|
|
})
|