对于因前端 vue history 路由模式下, 直接访问路径时, 出现的 404 响应码, 转化为 200 响应码. (404 下会将请求转发到首页)

This commit is contained in:
赵俊
2021-09-20 16:17:16 +08:00
parent 8dfc4f8004
commit 84f9354d4e
2 changed files with 3 additions and 0 deletions

View File

@@ -42,8 +42,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer(){
return factory -> {
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/index.html");
ErrorPage error200Page = new ErrorPage(HttpStatus.OK, "/index.html");
Set<ErrorPage> errorPages = new HashSet<>();
errorPages.add(error404Page);
errorPages.add(error200Page);
factory.setErrorPages(errorPages);
};
}

View File

@@ -0,0 +1 @@
package im.zhaojun.zfile.filter;