Skip to content

Commit a335a60

Browse files
fix(dashboard): Further fix to rate limiting in dev mode
1 parent e4c2d5a commit a335a60

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/dashboard/plugin/dashboard.plugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export interface DashboardPluginOptions {
150150
})
151151
export class DashboardPlugin implements NestModule {
152152
private static options: DashboardPluginOptions | undefined;
153+
private readonly rateLimitRequests = process.env.NODE_ENV === 'production' ? 500 : 100_000;
153154

154155
constructor(private readonly processContext: ProcessContext) {}
155156

@@ -185,7 +186,7 @@ export class DashboardPlugin implements NestModule {
185186
private createStaticServer(dashboardPath: string) {
186187
const limiter = rateLimit({
187188
windowMs: 60 * 1000,
188-
limit: process.env.NODE_ENV === 'production' ? 500 : 1_000_000,
189+
limit: this.rateLimitRequests,
189190
standardHeaders: true,
190191
legacyHeaders: false,
191192
});
@@ -240,7 +241,7 @@ export class DashboardPlugin implements NestModule {
240241
private createDefaultPage() {
241242
const limiter = rateLimit({
242243
windowMs: 60 * 1000,
243-
limit: process.env.NODE_ENV === 'production' ? 500 : 20_000,
244+
limit: this.rateLimitRequests,
244245
standardHeaders: true,
245246
legacyHeaders: false,
246247
});
@@ -267,7 +268,7 @@ export class DashboardPlugin implements NestModule {
267268
private createDynamicHandler(route: string, appDir: string, viteDevServerPort: number) {
268269
const limiter = rateLimit({
269270
windowMs: 60 * 1000,
270-
limit: process.env.NODE_ENV === 'production' ? 500 : 2000,
271+
limit: this.rateLimitRequests,
271272
standardHeaders: true,
272273
legacyHeaders: false,
273274
});

0 commit comments

Comments
 (0)