Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"react-qr-code": "^2.0.12",
"react-router-dom": "^6.11.2",
"recharts": "2",
"sirv": "^2.0.4"
"sirv": "^2.0.4",
"express-rate-limit": "^7.5.0"
},
"devDependencies": {
"@lingui/cli": "^4.7.0",
Expand Down
11 changes: 11 additions & 0 deletions frontend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import path from "node:path";
import {fileURLToPath} from "node:url";
import * as nodePath from "node:path";
import * as nodeUrl from "node:url";
import rateLimit from "express-rate-limit";

installGlobals();

Expand All @@ -30,6 +31,16 @@ const ssrManifest = isProduction
: undefined;

const app = express();

// set up rate limiter: maximum of 100 requests per 15 minutes
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // max 100 requests per windowMs
});

// apply rate limiter to all requests
app.use(limiter);

app.use(cookieParser());

app.use('/.well-known', express.static(path.join(__dirname, 'public/.well-known')));
Expand Down
Loading