paivana

HTTP paywall reverse proxy
Log | Files | Refs | Submodules | README | LICENSE

commit e661b59dc681f66f2e3b799a934c979161e0d200
parent 6f0c011e79b2f9ac9320c1be9c2feb665be2df81
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 26 Apr 2026 22:01:58 +0200

set VARY and CACHE_CONTROL headers in paywall responses

Diffstat:
Msrc/backend/paivana-httpd_templates.c | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/backend/paivana-httpd_templates.c b/src/backend/paivana-httpd_templates.c @@ -242,8 +242,18 @@ load_paywall (struct MHD_Connection *conn, MHD_add_response_header (reply, MHD_HTTP_HEADER_CONTENT_TYPE, "text/html")); - // FIXME: set Vary and other cache control headers on the static - // Paywall page! + /* The paywall body depends on the negotiated language and on + whether we deflated it for the client; tell intermediaries to + key their cache entries on both. */ + GNUNET_break (MHD_YES == + MHD_add_response_header (reply, + MHD_HTTP_HEADER_VARY, + MHD_HTTP_HEADER_ACCEPT_LANGUAGE ", " + MHD_HTTP_HEADER_ACCEPT_ENCODING)); + GNUNET_break (MHD_YES == + MHD_add_response_header (reply, + MHD_HTTP_HEADER_CACHE_CONTROL, + "public, max-age=300")); { struct ResponseCacheEntry *rce;