From 9e4e629a1a31a10f4599c5945fd29d96bb52a60c Mon Sep 17 00:00:00 2001 From: Athou Date: Thu, 11 Jan 2024 08:01:51 +0100 Subject: [PATCH] prevent caching openapi files, so that the documentation is always up to date --- .../src/main/java/com/commafeed/CommaFeedApplication.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java b/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java index b19a8ba6..a07a1480 100644 --- a/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java +++ b/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java @@ -221,6 +221,12 @@ public class CommaFeedApplication extends Application { environment.servlets() .addFilter("index-cache-busting-filter", new CacheBustingFilter()) .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "/"); + + // prevent caching openapi files, so that the documentation is always up to date + environment.servlets() + .addFilter("openapi-cache-busting-filter", new CacheBustingFilter()) + .addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), false, "/openapi.json", "/openapi.yaml"); + // prevent caching REST resources, except for favicons environment.servlets().addFilter("rest-cache-busting-filter", new CacheBustingFilter() { @Override