fix(webmvc): avoid index fallback exception for missing public routes (#298)

Return normal 404 behaviour when static resources are missing in backend only runs, by preventing a fallback to a missing index handler for unresolved routes
This commit is contained in:
Zach
2026-04-22 17:26:57 -04:00
committed by Zach Yale
parent 1625055689
commit a3add5ded9
@@ -42,9 +42,12 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override
protected Resource getResource(String resourcePath, Resource location) throws IOException {
Resource resource = location.createRelative(resourcePath);
return resource.exists() && resource.isReadable()
? resource
: new ClassPathResource("/static/index.html");
if (resource.exists() && resource.isReadable()) {
return resource;
}
Resource index = new ClassPathResource("/static/index.html");
return index.exists() && index.isReadable() ? index : null;
}
});
}