cors apifix

This commit is contained in:
2026-05-20 17:47:35 +05:30
parent c78b9a16e7
commit 302c7c0e8e
2 changed files with 28 additions and 22 deletions

View File

@@ -11,28 +11,34 @@ export default defineConfig(({ mode }) => {
console.warn('[xpress-docs] HASURA_ADMIN_SECRET is not set in .env.local; proxied requests will hit the API without auth.')
}
const proxyConfig = {
'/api': {
target: 'https://api.workolik.com',
changeOrigin: true,
secure: true,
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
if (secret) proxyReq.setHeader('x-hasura-admin-secret', secret)
})
}
},
'/live': {
target: 'https://jupiter.nearle.app',
changeOrigin: true,
secure: true,
}
}
return {
plugins: [react()],
server: {
port: 5173,
open: true,
proxy: {
'/api': {
target: 'https://api.workolik.com',
changeOrigin: true,
secure: true,
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
if (secret) proxyReq.setHeader('x-hasura-admin-secret', secret)
})
}
},
'/live': {
target: 'https://jupiter.nearle.app',
changeOrigin: true,
secure: true,
}
}
proxy: proxyConfig,
},
preview: {
port: 4173,
proxy: proxyConfig,
}
}
})