Make high-impact redirects that can be cached cacheable

Created on 16 October 2015, over 9 years ago
Updated 11 June 2025, 13 days ago

Problem/Motivation

#2476407: Use CacheableResponseInterface to determine which responses should be cached β†’ made several redirects that used to be cached in the Page Cache *and* were cacheable by browsers uncacheable. (Though it would seem that the fact that they used to be cacheable was merely accidental, since there's no test coverage for them.)

#2573923: Introduce a CacheableRedirectResponse and use it where appropriate β†’ introduces the necessary API addition to make those cacheable again.

This issue then aims to make high-impact redirects that can be cached cacheable again.

Proposed resolution

From #2573923-65: Introduce a CacheableRedirectResponse and use it where appropriate β†’ :

Candidates can be found like this:

find . -type f -and -not -ipath '*test*' -and -not -ipath '*form*' | xargs git grep -- -l '->redirect('

The following occurrences likely should be made cacheable:

  1. AccessDeniedSubscriber::onException() (redirect anonymous users from /user to /user/login)
  2. CommentController::redirectNode()
  3. SearchController::redirectSearchPage()

Make those 3 redirects cacheable.

Remaining tasks

TBD.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

base system

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024