Add authentication, user management, and database migration features
- Implement OAuth 2.0 and PAT authentication methods - Add user management, roles, and profile functionality - Add database migrations and admin user scripts - Update services for authentication and user settings - Add protected routes and permission hooks - Update documentation for authentication and database access
This commit is contained in:
@@ -15,6 +15,30 @@ export default defineConfig({
|
||||
'/api': {
|
||||
target: 'http://localhost:3001',
|
||||
changeOrigin: true,
|
||||
// Ensure cookies are forwarded correctly
|
||||
configure: (proxy, _options) => {
|
||||
proxy.on('proxyRes', (proxyRes, req, res) => {
|
||||
// Rewrite Set-Cookie headers to work with the proxy
|
||||
// Change domain from backend (localhost:3001) to frontend (localhost:5173)
|
||||
const setCookieHeaders = proxyRes.headers['set-cookie'];
|
||||
if (setCookieHeaders) {
|
||||
const rewritten = Array.isArray(setCookieHeaders)
|
||||
? setCookieHeaders.map(cookie => {
|
||||
// Remove domain attribute or rewrite it to work with proxy
|
||||
return cookie
|
||||
.replace(/;\s*domain=[^;]+/gi, '') // Remove domain
|
||||
.replace(/;\s*secure/gi, ''); // Remove secure in dev (if needed)
|
||||
})
|
||||
: [setCookieHeaders].map(cookie => {
|
||||
return cookie
|
||||
.replace(/;\s*domain=[^;]+/gi, '')
|
||||
.replace(/;\s*secure/gi, '');
|
||||
});
|
||||
proxyRes.headers['set-cookie'] = rewritten;
|
||||
console.log('[Vite Proxy] Rewritten Set-Cookie headers:', rewritten);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user