Skip to content

Commit

Permalink
fix: Disable the unconditional cache of front-end resources
Browse files Browse the repository at this point in the history
  • Loading branch information
CH3CHO committed Dec 26, 2024
1 parent 99a3c46 commit beadfa0
Showing 1 changed file with 5 additions and 2 deletions.
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,8 +38,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.noCache().mustRevalidate()).setUseLastModified(true).resourceChain(true)
.addResolver(new PathResourceResolver() {
@Override
protected Resource resolveResourceInternal(HttpServletRequest request, @NonNull String requestPath,
@NonNull List<? extends Resource> locations, @NonNull ResourceResolverChain chain) {
Expand Down

0 comments on commit beadfa0

Please sign in to comment.