Skip to content

nocache-Tags not being replaced sometimes when URL contains query parameters #11543

Open
@dryven-daniel

Description

@dryven-daniel

Bug description

We have set up a multi-site with full static caching enabled for our customer. Some regions of the website are dynamic and are replaced using the nocache tag. This setup works well, but recently, our customer reported a bug:

They launched a marketing campaign targeting a landing page on their website.

  • The URL includes the following UTM parameters: https://www.example.com/campaign?utm_source=linkedin.com&utm_medium=referral&utm_campaign=returnonprevention
  • The nocache tags aren't being replaced; instead, they remain empty.
  • After some testing, I discovered that the order of the query parameters affects the behavior. Rearranging them to ?utm_campaign=returnonprevention&utm_medium=referral&utm_source=linkedin.com resolves the issue.

Commenting out this line inside the NoCache Controller fixes the problem:
GitHub link

It seems that this line reorders the query parameters, preventing the nocache tags from being replaced correctly.

How to reproduce

Logs

Environment

Application Name: Statamic
Laravel Version: 12.1.1
PHP Version: 8.3.14
Composer Version: 2.7.2
Environment: local
Debug Mode: ENABLED
URL: statamic.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: full
Version: 5.49.1 Solo

Installation

Fresh statamic/statamic site via CLI

Additional details

It might have something to do with this PR: #7486

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions