From ad83d2d753410750e94a951fe9d359b8a2b509f2 Mon Sep 17 00:00:00 2001 From: CH3CHO Date: Thu, 26 Dec 2024 13:25:42 +0800 Subject: [PATCH] fix: Disable the cache of front-end resources --- .../java/com/alibaba/higress/console/WebMvcInitializer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/console/src/main/java/com/alibaba/higress/console/WebMvcInitializer.java b/backend/console/src/main/java/com/alibaba/higress/console/WebMvcInitializer.java index 08b6e582..624a7a01 100644 --- a/backend/console/src/main/java/com/alibaba/higress/console/WebMvcInitializer.java +++ b/backend/console/src/main/java/com/alibaba/higress/console/WebMvcInitializer.java @@ -19,6 +19,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; +import org.springframework.http.CacheControl; import org.springframework.lang.NonNull; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; @@ -36,8 +37,9 @@ public class WebMvcInitializer implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler("/*").addResourceLocations("classpath:/static/").setUseLastModified(true) - .resourceChain(true).addResolver(new PathResourceResolver() { + registry.addResourceHandler("/*").addResourceLocations("classpath:/static/") + .setCacheControl(CacheControl.noStore()).setUseLastModified(false).resourceChain(true) + .addResolver(new PathResourceResolver() { @Override protected Resource resolveResourceInternal(HttpServletRequest request, @NonNull String requestPath, @NonNull List locations, @NonNull ResourceResolverChain chain) {