Problem/Motivation

The purl module overrides the router.route_provider with PurlRouteProvider, which allows it to vary the route matching in cases where a purl modifier is matched. It primarily does this by adding the purl modifier to the CID so that when a modifier is active and alters the request, it is cached separately.

The core route provider does the same thing for language and query parameters.

When a modifier is not active purl adds the path information in addition to the query string, assuming that it encompasses the data needed to match modifiers but leaves out the host information. If a host modifier is active, then this can allow bad route cache entries to be cached and cause the route information to be incorrect.

Steps to reproduce

  • Enable a host modifier
  • Go to a URI where the host modifier is not matched, but the route is altered.
  • Go to a URI where the host modifier is matched, and the route is altered by the modifier.
  • Notice that the route is loaded from cache with the first altered route.

Proposed resolution

Update getRouteCollectionForRequest to incorporate the host in it's cache. Additionally update the pattern of creating the CID to use getRouteCollectionCacheId and addExtraCacheKeyPart that have since been added.

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork purl-3593266

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

rbrandon created an issue. See original summary.

rbrandon’s picture

Version: 8.x-1.x-dev » 2.0.0
rbrandon’s picture

Title: Bug: Route provider cache does not vary on all types of purl modufiers » Bug: Route provider cache does not vary on all types of purl modifiers

scottatdrake’s picture

Status: Active » Reviewed & tested by the community

Looking good to me.

rbrandon’s picture

Status: Reviewed & tested by the community » 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.