Problem/Motivation

When a controller asks for a specific max-age the Cache-Control header gets overwritten by CacheableResponseSubscriber

Steps to reproduce

Create a controller that returns a CacheableJsonResponse with a low max-age (in my case this is for sitewide_alerts).
Call the endpoint of that controller and observe that the set Cache-Control header gets overwritten by a default.

Proposed resolution

Add a check to see if the Cache-Control header is overwritten. If so, keep it.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

victonator created an issue. See original summary.

victonator’s picture

Assigned: victonator » Unassigned
Status: Active » Needs review

shumer made their first commit to this issue’s fork.

shumer’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • shumer committed 8cea40b6 on 4.x authored by victonator
    Issue #3586257: Fix CacheableResponseSubscriber ignoring custom Cache-...