Merge pull request #8732 from dataease/pr@dev-v2@refactor_http-cache

refactor(系统设置): 修改http缓存逻辑
This commit is contained in:
王嘉豪 2024-03-27 15:06:36 +08:00 committed by GitHub
commit 50ff67b7b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ import java.io.IOException;
@Component
public class HtmlResourceFilter implements Filter, Ordered {
@Value("${dataease.http.cache:true}")
@Value("${dataease.http.cache:false}")
private Boolean httpCache;
@Override
@ -28,7 +28,7 @@ public class HtmlResourceFilter implements Filter, Ordered {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
if(httpCache!=null && httpCache){
if(httpCache == null || !httpCache){
// 禁用缓存
httpResponse.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
httpResponse.setHeader("Cache", "no-cache");