Skip to content

[5.x]: Cache includes links with x-craft-live-preview in query params #15586

@niektenhoopen

Description

@niektenhoopen

What happened?

Description

If you open preview mode on an entry that has no changes, the token is not in the URLs of links in the preview mode, but the x-craft-live-preview token is.

If you use {% cache %} in your templates, this part will be cached with the x-craft-live-preview added to all links in the cached part of code.

The reason that it's cached, is probably because there is no token:

if ($request->getHadToken()) {

This way, you will end up with x-craft-live-preview tokens in the Google index (and that's precisely what is happened now)

Steps to reproduce

  1. See above

Expected behavior

No x-craft-live-preview-URLs on a production website

Actual behavior

Craft CMS version

5.3.4

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions