feat: 首页更新
This commit is contained in:
@@ -11,37 +11,39 @@ const app = express();
|
||||
const PORT = 8086;
|
||||
|
||||
// 启用 CORS
|
||||
app.use(cors({
|
||||
origin: '*', // 允许所有源,开发环境使用
|
||||
credentials: true,
|
||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
||||
allowedHeaders: [
|
||||
'Content-Type',
|
||||
'Authorization',
|
||||
'X-Requested-With',
|
||||
'Accept',
|
||||
// 自定义请求头
|
||||
'cmdId',
|
||||
'datetime',
|
||||
'pwds',
|
||||
'aseqId',
|
||||
'nc',
|
||||
'apiName',
|
||||
'tid',
|
||||
'custId',
|
||||
'reqId',
|
||||
'isMobileOpen',
|
||||
'languageNum',
|
||||
'project',
|
||||
'platform',
|
||||
'checkOr',
|
||||
'tbc',
|
||||
'reqKey',
|
||||
'signature',
|
||||
'authorization',
|
||||
],
|
||||
exposedHeaders: ['cmdId', 'datetime', 'pwds', 'aseqId', 'nc', 'checkOr', 'checkor'],
|
||||
}));
|
||||
app.use(
|
||||
cors({
|
||||
origin: '*', // 允许所有源,开发环境使用
|
||||
credentials: true,
|
||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'],
|
||||
allowedHeaders: [
|
||||
'Content-Type',
|
||||
'Authorization',
|
||||
'X-Requested-With',
|
||||
'Accept',
|
||||
// 自定义请求头
|
||||
'cmdId',
|
||||
'datetime',
|
||||
'pwds',
|
||||
'aseqId',
|
||||
'nc',
|
||||
'apiName',
|
||||
'tid',
|
||||
'custId',
|
||||
'reqId',
|
||||
'isMobileOpen',
|
||||
'languageNum',
|
||||
'project',
|
||||
'platform',
|
||||
'checkOr',
|
||||
'tbc',
|
||||
'reqKey',
|
||||
'signature',
|
||||
'authorization',
|
||||
],
|
||||
exposedHeaders: ['cmdId', 'datetime', 'pwds', 'aseqId', 'nc', 'checkOr', 'checkor'],
|
||||
})
|
||||
);
|
||||
|
||||
// 目标 API 服务器地址
|
||||
const API_TARGET = process.env.API_TARGET || 'https://51zhh5.notbug.org';
|
||||
@@ -74,8 +76,14 @@ PROXY_PATHS.forEach((path) => {
|
||||
// 确保 CORS 头被正确设置
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS, PATCH');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With, Accept, cmdId, datetime, pwds, aseqId, nc, apiName, tid, custId, reqId, isMobileOpen, languageNum, project, platform, checkOr, tbc, reqKey, signature, authorization');
|
||||
res.setHeader('Access-Control-Expose-Headers', 'cmdId, datetime, pwds, aseqId, nc, checkOr, checkor');
|
||||
res.setHeader(
|
||||
'Access-Control-Allow-Headers',
|
||||
'Content-Type, Authorization, X-Requested-With, Accept, cmdId, datetime, pwds, aseqId, nc, apiName, tid, custId, reqId, isMobileOpen, languageNum, project, platform, checkOr, tbc, reqKey, signature, authorization'
|
||||
);
|
||||
res.setHeader(
|
||||
'Access-Control-Expose-Headers',
|
||||
'cmdId, datetime, pwds, aseqId, nc, checkOr, checkor'
|
||||
);
|
||||
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
||||
},
|
||||
onError: (err, req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user