Skip to content

Commit

Permalink
fix: Disable the cache of front-end resources (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
CH3CHO authored Dec 26, 2024
1 parent 94cfa0d commit a783f45
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
*/
package com.alibaba.higress.console;

import java.time.Duration;
import java.util.Arrays;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

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;
Expand All @@ -36,7 +38,8 @@ public class WebMvcInitializer implements WebMvcConfigurer {

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/*").addResourceLocations("classpath:/static/").setUseLastModified(true)
registry.addResourceHandler("/*").addResourceLocations("classpath:/static/")
.setCacheControl(CacheControl.maxAge(Duration.ZERO).mustRevalidate()).setUseLastModified(true)
.resourceChain(true).addResolver(new PathResourceResolver() {
@Override
protected Resource resolveResourceInternal(HttpServletRequest request, @NonNull String requestPath,
Expand Down

0 comments on commit a783f45

Please sign in to comment.