[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.
This commit is contained in:
Ivan Gabaldon
2025-07-19 10:19:17 +02:00
committed by GitHub
parent b0107a0801
commit 8de6ea65ab
2 changed files with 7 additions and 9 deletions

View File

@@ -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

View File

@@ -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