@@ -11,6 +11,7 @@ import searchRoutes from "./routes/search";
1111import attachmentRoutes from "./routes/attachments" ;
1212import templatesRoutes from "./routes/templates" ;
1313import { requireAuth } from "./middleware/auth" ;
14+ import { healthCheckLimiter , staticFileLimiter } from "./middleware/rateLimiters" ;
1415import { GitService } from "./services/gitService" ;
1516import { DATA_DIR as DEFAULT_DATA_DIR , FileSystemService } from "./services/fileSystem" ;
1617
@@ -258,25 +259,25 @@ app.use("/api/search", requireAuth, searchRoutes); // Protected
258259app . use ( "/api/attachments" , requireAuth , attachmentRoutes ) ; // Protected
259260
260261// Health check
261- app . get ( "/api/health" , ( req : Request , res : Response ) => {
262+ app . get ( "/api/health" , healthCheckLimiter , ( req : Request , res : Response ) => {
262263 res . json ( { status : "ok" } ) ;
263264} ) ;
264265
265266// Handle .well-known/* routes that aren't supported (for MCP clients doing OAuth discovery)
266- app . get ( "/.well-known/oauth-authorization-server" , ( req : Request , res : Response ) => {
267+ app . get ( "/.well-known/oauth-authorization-server" , healthCheckLimiter , ( req : Request , res : Response ) => {
267268 res . status ( 404 ) . json ( { error : "OAuth not supported" , message : "This server uses API key authentication" } ) ;
268269} ) ;
269- app . get ( "/.well-known/openid-configuration" , ( req : Request , res : Response ) => {
270+ app . get ( "/.well-known/openid-configuration" , healthCheckLimiter , ( req : Request , res : Response ) => {
270271 res . status ( 404 ) . json ( { error : "OIDC not supported" , message : "This server uses API key authentication" } ) ;
271272} ) ;
272273
273274// Serve static files in production
274275if ( process . env . NODE_ENV === "production" ) {
275276 const clientDistPath = path . join ( __dirname , "../../client/dist" ) ;
276- app . use ( express . static ( clientDistPath ) ) ;
277+ app . use ( staticFileLimiter , express . static ( clientDistPath ) ) ;
277278
278279 // Handle client-side routing - serve index.html for all non-API routes
279- app . get ( / .* / , ( req : Request , res : Response ) => {
280+ app . get ( / .* / , staticFileLimiter , ( req : Request , res : Response ) => {
280281 res . sendFile ( path . join ( clientDistPath , "index.html" ) ) ;
281282 } ) ;
282283}
0 commit comments