| 12345678910111213141516171819202122 |
- const PROXY_CONFIG = {
- "/api": {
- target: "http://localhost:3002",
- secure: false,
- changeOrigin: true,
- logLevel: "debug",
- onProxyReq: (proxyReq, req, res) => {
- // 确保转发 Authorization header
- if (req.headers.authorization) {
- proxyReq.setHeader('Authorization', req.headers.authorization);
- console.log('[Proxy] 转发 Authorization header:', req.headers.authorization.substring(0, 30) + '...');
- } else {
- console.log('[Proxy] 请求没有 Authorization header');
- }
- },
- onProxyRes: (proxyRes, req, res) => {
- console.log('[Proxy] 响应状态:', proxyRes.statusCode, '请求:', req.method, req.url);
- }
- }
- };
- module.exports = PROXY_CONFIG;
|