diff --git a/services/s3-revproxy/default.nix b/services/s3-revproxy/default.nix index b456fb1..cbc8345 100644 --- a/services/s3-revproxy/default.nix +++ b/services/s3-revproxy/default.nix @@ -122,6 +122,16 @@ in allowMethods = [ "GET" ]; allowOrigins = [ "*" ]; }; + + cache = { + noCacheEnabled = false; + # Taken from the original Perl script. + # maxage=600: Serve from cache for 5 minutes. + # stale-while-revaliadate=1800: Serve from cache while updating in the background for 30 minutes. + # https://web.dev/stale-while-revalidate/ + # https://developer.fastly.com/learning/concepts/cache-freshness/ + cacheControl = "maxage=600,stale-while-revalidate=1800,public"; + }; }; targets = mapAttrs (name: bucket: mkTarget { inherit name bucket; }) cfg.targets; };