File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import { env } from "../../core";
7
7
// to be separate unlike old implementation
8
8
9
9
export const openapi = async ( server : FastifyInstance ) => {
10
- if ( process . env . NODE_ENV === "production" ) {
11
- return Promise . resolve ( ) ;
12
- }
13
10
await server . register ( swagger , {
14
11
mode : "dynamic" ,
15
12
openapi : {
Original file line number Diff line number Diff line change @@ -26,6 +26,16 @@ const createServer = async (serverName: string): Promise<FastifyInstance> => {
26
26
) ;
27
27
}
28
28
29
+ if ( process . env . NODE_ENV === "production" ) {
30
+ if ( request . routerPath ?. includes ( "static" ) ) {
31
+ return reply . status ( 404 ) . send ( {
32
+ statusCode : 404 ,
33
+ error : "Not Found" ,
34
+ message : "Not Found" ,
35
+ } ) ;
36
+ }
37
+ }
38
+
29
39
const { url } = request ;
30
40
// Skip Authentication for Health Check and Static Files and JSON Files for Swagger
31
41
// Doing Auth check onRequest helps prevent unauthenticated requests from consuming server resources.
You can’t perform that action at this time.
0 commit comments