From 8de6ea65ab34ad2d3833cbf13b826c8162fc3269 Mon Sep 17 00:00:00 2001 From: Ivan Gabaldon Date: Sat, 19 Jul 2025 10:19:17 +0200 Subject: [PATCH] [fix] container: remove static hashing (#410) * [fix] container: remove static hashing Allows browser cache heuristics to properly work. Related https://github.com/searxng/searxng/pull/5006 Closes https://github.com/searxng/searxng-docker/issues/409 * [fix] container: don't revalidate at every request As Granian no longer handles static files directly, the whole process goes through Flask, which apart from being slow, is resource intensive, even to serve HTTP 304 responses. --- Caddyfile | 14 +++++++------- searxng/settings.yml | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Caddyfile b/Caddyfile index a18a9ca..d892524 100644 --- a/Caddyfile +++ b/Caddyfile @@ -42,14 +42,14 @@ encode zstd gzip path /stats/checker } -@imageproxy { - path /image_proxy -} - @static { path /static/* } +@imageproxy { + path /image_proxy +} + header { # CSP (https://content-security-policy.com) Content-Security-Policy "upgrade-insecure-requests; default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; form-action 'self' https:; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self'; img-src * data:; frame-src https:;" @@ -77,9 +77,9 @@ header @api { route { # Cache policy - header Cache-Control "max-age=0, public, must-revalidate" - header @imageproxy Cache-Control "max-age=3600, public" - header @static Cache-Control "max-age=31536000, public, immutable" + header Cache-Control "no-cache" + header @static Cache-Control "public, max-age=30, stale-while-revalidate=60" + header @imageproxy Cache-Control "public, max-age=3600" } # SearXNG diff --git a/searxng/settings.yml b/searxng/settings.yml index d4a846a..554ad80 100644 --- a/searxng/settings.yml +++ b/searxng/settings.yml @@ -5,7 +5,5 @@ server: secret_key: "ultrasecretkey" # change this! limiter: false # enable this when running the instance for a public usage on the internet image_proxy: true -ui: - static_use_hash: true redis: url: redis://redis:6379/0