swagger-ui静态资源缓存

Signed-off-by: abbfun <819589789@qq.com>
This commit is contained in:
abbfun 2022-10-19 09:07:35 +00:00 committed by Gitee
parent bf83fe568b
commit 78f4d1c85b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 1 deletions

View File

@ -33,7 +33,8 @@ public class ResourcesConfig implements WebMvcConfigurer
/** swagger配置 */ /** swagger配置 */
registry.addResourceHandler("/swagger-ui/**") registry.addResourceHandler("/swagger-ui/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS).mustRevalidate().cachePrivate()).resourceChain(true);
} }
/** /**

View File

@ -124,6 +124,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 添加CORS filter // 添加CORS filter
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
// 禁用缓存
httpSecurity.headers().cacheControl().disable();
} }
/** /**