We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30aba9d commit 196a0c3Copy full SHA for 196a0c3
server.mjs
@@ -23,6 +23,8 @@ const remixHandler = createRequestHandler({
23
24
const app = express();
25
26
+app.set('trust proxy', true);
27
+
28
app.use(
29
cors({
30
// 允许所有来源访问,生产环境中应该设置为特定的域名
@@ -41,6 +43,7 @@ const globalLimiter = rateLimit({
41
43
standardHeaders: 'draft-7', // 返回标准的 RateLimit 头信息
42
44
legacyHeaders: false, // 禁用旧的 X-RateLimit 头信息
45
message: '请求过于频繁,请稍后再试',
46
+ proxy: true,
47
});
48
49
// 针对聊天 API 的特殊限流中间件
@@ -52,6 +55,7 @@ const chatApiLimiter = rateLimit({
52
55
message: '聊天请求过于频繁,请稍后再试',
53
56
// 仅对聊天 API 路由应用此限制
54
57
skip: (req) => !req.url.includes('/api/chat'),
58
59
60
61
app.use((req, res, next) => {
0 commit comments