Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHill-00000003GOw-220d for pgsql-www@arkaria.postgresql.org; Fri, 16 Oct 2026 14:18:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xHilj-0000000Eavl-3rFB for pgsql-www@arkaria.postgresql.org; Fri, 16 Oct 2026 14:18:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHilj-0000000Eava-2tXJ; Fri, 16 Oct 2026 14:18:47 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xHilh-00000002Ux8-0UMp; Fri, 16 Oct 2026 14:18:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description; bh=wzpUTXJUB9zyx+OI3kOt5JB/co6RuJ7KPNGA1LeoS6M=; b=HMYEwKiCpT5sPWKBbw973W0Fjz azdnkVw7P1OnZODI/PPo1LLCDZnPPq/C5Bo8ulhnPz13WTSr7645phDrPH+aKC99DR30PFsHkgEhP 0sXNIXRB9zndwYiNlc3tH479G14CmUfar3XXWWbJWbrXCS3r6tQEpui0kVQqMU15zJa+OWDMocdYs M9sV46Dv4Z6Tmf4laNpxOUxwRMk7xfu/0woIS+RD9V8YydohY77yfTFxHu107vC9YlDYzlikHbwPT CLBReb3Ml+H8Kx/WJNuIXwCOu6aBZS57rI45jJX5uGnotGeRVVedG1945dRhv5zcI55f+4g969kVi twKw7wwA==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1xHile-0061cJ-0u; Fri, 16 Oct 2026 14:18:42 +0000 Date: Fri, 16 Oct 2026 16:18:41 +0200 From: Christoph Berg To: Dave Page Cc: Magnus Hagander , "Jonathan S. Katz" , Daniel Gustafsson , pgsql-www@lists.postgresql.org, Andrey Borodin , Melanie Plageman , PostgreSQL Contributors Subject: Re: Introduce contributor badges Message-ID: References: <329b5d0e-44ba-4c5f-8cc9-c9eb5424955b@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Debian-User: myon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Re: To Dave Page > > ## Varnish cache invalidation > > > 4. **The image URL never changes when the image does.** > > `/community/badge//image/` has no file extension and no version in > > it. The docs say Varnish applies a longer policy to images "because they > > are considered never to change". Varnish itself is purged, but if the > > Varnish configuration (VCL) also sends long browser cache headers for > > images, browsers will keep showing the old image. > > I think purging Varnish is enough here. Badge image changes aren't > critical, if a user sees the image somewhat longer, that doesn't cause > trouble. I did more research on this point, and that's the result (poking around and by Deepseek): Key finding: the cache policy is s-maxage, i.e. shared-cache only docs/frontend.rst:39-46: │ There is a longer default policy set for images, because they are considered never to change. Any view … │ can override this default, by specifying the Cache-control: s-maxage=xxx http header … using the @cache() │ decorator. And that's exactly what the decorator emits (pgweb/util/decorators.py): resp['Cache-Control'] = 's-maxage=%s' % (...) s-maxage is honoured only by shared caches (Varnish); browsers ignore it and fall back to no explicit freshness. badge_image itself sets no Cache-Control at all (only ETag), so: - the "longer policy for images" is a Varnish TTL (how long Varnish holds it) — and that's the copy our purge_urls already invalidates on save; - browsers are never asked to cache the image long, so a changed image can't go stale in a browser under the documented design (they'll revalidate via ETag, or not cache). So the risk in comment #4 only materialises if the out-of-repo VCL re-adds a browser max-age for images — which would contradict the app's own header. That's a hypothetical, not something the repo does. Recommendation No URL versioning. It requires a schema change, and the repository's own contract (s-maxage) is that only Varnish caches. Adding ?v= "to avoid the question" pays a real cost to guard against a configuration the app already argues against. On the related "minor" comment: > - `badge_image` fetches the image and computes its MD5 before it checks > `If-None-Match`; storing the hash would avoid both. badge_image is only reached on a Varnish miss, and on a miss we're almost always about to serve the image anyway. Storing the hash only helps the narrow (?) "Django itself receives a conditional request" case. So, I would say everything already works like it should. (If we wanted, We could add explicit Cache-Control headers on badge_image.) Christoph