I’m trying to add Etag-based conditional rendering to my Django site. When I request a page, it generates an Etag which is returned to the client. The next time it views the page, the client can make a conditional-get request by passing the “If-None-Match” header with the previous Etag value. If the Etag matches, the full page isn’t rendered and the web page returns 304 Not Modified. This kind of caching can also be used by reverse-proxies like Apache’s mod_cache.
Unfortunately, Django seems to be returning a
Content-Length: 0 header with its 304 reply. In this case, mod_cache deems the response uncachable! as this content length doesn’t match the content-length of the previous response (which included the full page).
I would make a bug report, but I’m not sure exactly where fault for this issue lies. I’d appreciate advice on next steps.