Normalize trailing slashes in the page cache

Created on 14 April 2024, 5 months ago
Updated 15 April 2024, 5 months ago

Problem/Motivation

Pointed out by @Dries

When I inspect my caches, many pages are in there twice. Once with a trailing / and once without.

We can't do a lot of URL normalization in the page cache, because we don't want to call any APIs, but we can call rtrim().

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
Page cacheΒ  β†’

Last updated 2 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

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

Merge Requests

Comments & Activities

  • Issue created by @catch
  • Merge request !7488rtrim() the cid. β†’ (Open) created by catch
  • Status changed to Needs review 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom catch
  • πŸ‡¬πŸ‡§United Kingdom catch

    Probably the main issue with this is it might prevent redirect/global redirect from always redirecting to the trailing forward slash version of the path - previously that redirect would have prevented page caching from writing to the cache due to the redirect.

    Maybe if redirect runs in an early enough middleware it might not though, or we could open an issue about it?

  • Status changed to Needs work 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems to caused a cache test failure in blocks.

  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    RedirectLeadingSlashesSubscriber adds a cacheable redirect if there are multiple leading slashes, should we just extend this to trailing slashes?

Production build 0.71.5 2024