diff --git a/booklore-api/src/main/java/org/booklore/config/WebMvcConfig.java b/booklore-api/src/main/java/org/booklore/config/WebMvcConfig.java index b3cee12a9..8b5960e4f 100644 --- a/booklore-api/src/main/java/org/booklore/config/WebMvcConfig.java +++ b/booklore-api/src/main/java/org/booklore/config/WebMvcConfig.java @@ -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; } }); }