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:
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user