Last-Modified response header not respected if too far in the past

RESOLVED INVALID

Status

()

Core
Networking
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: Stefan Majewsky, Unassigned)

Tracking

13 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
I was using Firebug's Net Panel to investigate how my site loading is affected by the browser cache, esp. w.r.t. included CSS and JS files. I saw the Last-Modified header being included in all server responses, but Firefox would not always, upon a page reload, include the complementary If-Modified-Since header in its request.

Through trial and error, I found that If-Modified-Since is only included if the Last-Modified header which was received with the last request of this file contains a timestamp which lies *past* the time when I launched Firefox.

For example, scenario 1:

1a. Change JS file on server.
1b. Start Firefox.
1c. Load page.
1d. Reload page.

Versus scenario 2:

2a. Start Firefox.
2b. Change JS file on server.
2c. Load page.
2d. Reload page.

In both cases, Firefox requests the JS file in step C, and the reply includes a Last-Modified header.

In scenario 1, the re-request of the JS file in step D will not include the If-Modified-Since header, so the server replies 200 OK and delivers the file again. According to the Net panel, Firefox then uses the version of the file already in the cache, presumably because Last-Modified is identical to the first reply in step C.

In scenario 2, the If-Modified-Since header is in the re-request, and the server correctly answers 304 Not Modified.

I could not come up with a useful reason why the browser launch time should be relevant for how Last-Modified is interpreted, hence I consider this a bug.
(Reporter)

Comment 1

6 years ago
My server is HTTPS-only.
Component: Untriaged → Networking
Product: Firefox → Core
QA Contact: untriaged → networking
Stefan, is there any chance of a link to the server?

Alternately, a log created using the instructions at https://developer.mozilla.org/en/HTTP_Logging though this won't be as useful....

Note that there _is_ one thing that depends on the relationship between last-modified and startup time, and that's the behavior of the "validate once per session" preference setting.  But that should only affect whether validation is forced, not whether If-Modified-Since is set.  It's also not the default setting.  Just to check, what's the value of browser.cache.check_doc_frequency in your about:config?
(Reporter)

Comment 3

6 years ago
That logging method you linked to was very helpful. Upon studying this log, I saw that I was just misreading Firebug's Net Panel. Firefox was using its cache all the time. I was confused by the cached response appearing in Firebug not only at "Response Headers from Cache", but also below "Response Headers".

So I'm resolving this as invalid. Thanks for your quick help. And by the way, check_doc_frequency = 3.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
Stefan, thanks for the update!  And 3 is the default, yes.  ;)
You need to log in before you can comment on or make changes to this bug.