cors apifix
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user