@@ -17,21 +17,26 @@ if (env.FRACTAL_SERVER_HOST.endsWith('/')) {
1717}
1818
1919export async function handle ( { event, resolve } ) {
20- if ( event . url . pathname . startsWith ( '/_app' ) ) {
21- // The _app folder contains static files that are the result of npm build.
22- // The hooks handle function is not called when loading valid static files, however we can
23- // reach this point if a not existing file is requested. That could happen after an update
24- // if the browser is loading a cached page that references to outdated contents.
25- // In that case we can just skip the whole function.
26- return await resolve ( event ) ;
27- }
28-
2920 if ( event . url . pathname . startsWith ( '/api' ) ) {
3021 // API page - AJAX request - handled in proxy'
3122 logger . trace ( 'API endpoint detected, leaving the handling to the proxy' ) ;
3223 return await resolve ( event ) ;
3324 }
3425
26+ if ( event . route . id === null ) {
27+ if ( event . url . pathname . startsWith ( '/_app' ) ) {
28+ // The _app folder contains static files that are the result of npm build.
29+ // The hooks handle function is not called when loading valid static files, however we can
30+ // reach this point if a not existing file is requested. That could happen after an update
31+ // if the browser is loading a cached page that references to outdated contents.
32+ // In that case we can usually ignore the logs.
33+ logger . trace ( '[%s] - %s - [NOT FOUND]' , event . request . method , event . url . pathname ) ;
34+ } else {
35+ logger . info ( '[%s] - %s - [NOT FOUND]' , event . request . method , event . url . pathname ) ;
36+ }
37+ throw error ( 404 , 'Route not found' ) ;
38+ }
39+
3540 logger . info ( '[%s] - %s' , event . request . method , event . url . pathname ) ;
3641
3742 // Retrieve server info (alive and version)
0 commit comments