Files
uis-cloud-computing/7project/frontend/vite.config.ts

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/, ''),
},
},
},
})