Skip to content

Commit

Permalink
Add caching directives for /iframe/table/ and /iframe/chart/ (#3829)
Browse files Browse the repository at this point in the history
Partial #3827
  • Loading branch information
devinrsmith committed May 19, 2023
1 parent fb6883a commit c92f5ce
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -95,11 +96,12 @@ public JettyBackedGrpcServer(
}
context.setInitParameter(DefaultServlet.CONTEXT_INIT + "dirAllowed", "false");

// For the Web UI, cache everything in the static folder
// https://create-react-app.dev/docs/production-build/#static-file-caching
context.addFilter(NoCacheFilter.class, "/ide/*", EnumSet.noneOf(DispatcherType.class));
// Cache all of the appropriate assets folders
for (String appRoot : List.of("/ide/", "/iframe/table/", "/iframe/chart/")) {
context.addFilter(NoCacheFilter.class, appRoot + "*", EnumSet.noneOf(DispatcherType.class));
context.addFilter(CacheFilter.class, appRoot + "assets/*", EnumSet.noneOf(DispatcherType.class));
}
context.addFilter(NoCacheFilter.class, "/jsapi/*", EnumSet.noneOf(DispatcherType.class));
context.addFilter(CacheFilter.class, "/ide/assets/*", EnumSet.noneOf(DispatcherType.class));
context.addFilter(DropIfModifiedSinceHeader.class, "/*", EnumSet.noneOf(DispatcherType.class));

context.setSecurityHandler(new ConstraintSecurityHandler());
Expand Down

0 comments on commit c92f5ce

Please sign in to comment.