[Solved] How to get 304 Not Modified - response with mod_deflate
Added by meier22 almost 3 years ago
I'm using Lighttpd 1.4.64 with mod_ssl + HTTP/2 + etags + mod_deflate and static content.
The browser sends a request with e.g. containing:
if-modified-since: Sun, 30 Jan 2022 12:45:04 GMT if-none-match: "288499645-br"
I would expect an status 304 - response for unmodified content.
But I always get an status 200 - response with the same etag and modification time.
Without mod_deflate it works as expected.
Is a status 304 - response not supported with mod_deflate and static content?
Replies (3)
RE: How to get 304 Not Modified - response with mod_deflate - Added by gstrauss almost 3 years ago
Is a status 304 - response not supported with mod_deflate and static content?
The intention is that it is supposed to be supported. I'll take a closer look.
Are you using deflate.cache-dir
? Please share your deflate config.
RE: How to get 304 Not Modified - response with mod_deflate - Added by gstrauss almost 3 years ago
ick. That's a bug. Thank you for reporting it. This has been broken since lighttpd 1.4.51. The bug is the lighttpd mod_deflate is incorrectly looking for If-None-Match in the response headers rather than in the request headers. Here is a patch.
--- a/src/mod_deflate.c +++ b/src/mod_deflate.c @@ -1823,7 +1823,7 @@ REQUEST_FUNC(mod_deflate_handle_response_start) { vb = http_header_response_get(r, HTTP_HEADER_ETAG, CONST_STR_LEN("ETag")); etaglen = vb ? buffer_clen(vb) : 0; if (etaglen && light_btst(r->rqst_htags, HTTP_HEADER_IF_NONE_MATCH)) { - const buffer *if_none_match = http_header_response_get(r, HTTP_HEADER_IF_NONE_MATCH, CONST_STR_LEN("If-None-Match")); + const buffer *if_none_match = http_header_request_get(r, HTTP_HEADER_IF_NONE_MATCH, CONST_STR_LEN("If-None-Match")); if ( r->http_status < 300 /*(want 2xx only)*/ && NULL != if_none_match && 0 == strncmp(if_none_match->ptr, vb->ptr, etaglen-1)
RE: How to get 304 Not Modified - response with mod_deflate - Added by gstrauss almost 3 years ago
I filed bug #3143. Patch is on lighttpd git master and will be part of the next lighttpd release.