HTTP Cache Control needs documentation that the max_age value cannot be the same as a response code value

Created on 22 April 2022, about 2 years ago
Updated 10 March 2023, over 1 year ago

Problem/Motivation

Recently, our team noticed an issue in which our 404 error pages had an s-max-age of 30 days, despite them being defined as 5 minutes. After doing some sleuthing, we determined that this line was causing the issue: https://git.drupalcode.org/project/http_cache_control/-/blob/8.x-2.x/src...

Because we had the regular max-age (the browser max-age) and the 404 max-age both set to be 5 minutes, this conditional did not pass. Thus, our 404 pages were receiving our 'global' s-max-age, rather than the max-age defined in the settings.

Changing the max-age from 5 minutes to 3 minutes resolved this situation. However, we only came to this solution after reviewing the module's code -- this limitation is not explained anywhere else.

Proposed resolution

Either document on the module page or in the System Performance settings form that these values cannot be the same.

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kmonty San Francisco, CA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡ͺSweden kevineinarsson

    Attached a test + patch (not a clean patch but it... works(?)) Maybe need to check if these values are null too.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΈπŸ‡ͺSweden kevineinarsson

    The patch doesn't work, s-maxage and max-age are always set to the same value.
    The configuration form says that the 3xx/404/5xx max-age value should be the same as 200 responses. If that's the case, why is setClientTtl called?

Production build 0.69.0 2024