Skip to content

Website caching issue #1215

@paulirwin

Description

@paulirwin

The Lucene.NET website has a server-side caching issue where, after rolling out an update, the returned etag value was the same, which caused browsers that have the previously-cached contents to not get the update. More details below.

Originally posted by @paulirwin in #1198 (comment)

I found the problem (but not the cause, yet) of the caching issue: the etag returned has not changed between the old and new sites.

I fortunately had another browser instance still open that had the old cached version. Doing a normal load of the page was sending If-None-Match with etag value "24f2-6428c36d87de9-gzip". (If you're unfamiliar, If-None-Match sends a previously returned etag value, to check if it matches. If it doesn't match, the server should return 200 OK with the updated contents along with a new etag header to update its cached value, and if it matches, that means the cached version is up to date so the server returns 304 Not Modified with an empty body.)

The server returned with a 304 Not Modified and also included the etag response header with the same value, which is interpreted by the browser as "the server confirmed that my cached version is correct". So this is not a client-side caching issue, this is actually the server saying that the cached version is correct.

I then looked at what was happening in a browser that had the updated HTML/etc, and it was sending and receiving the exact same header value. So something is wrong on the server to where it's returning the same etag value even if the code has changed.

Note that the server does not send either an Expires header nor Cache-Control header with max-age, so effectively this cache may never expire since, according to the server, the etag value is exactly the same as before.

I am not sure why the server is returning the same etag value as before, as that is usually produced as effectively a hash of the contents of that page/resource, which should have changed with the updated HTML. If we are producing that etag and hardcoding it somewhere, we should fix that. Or perhaps this is an issue with the server infrastructure?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions