Skip to content

Static caching first request is creating race condition with CDN #13800

@patrickomeara

Description

@patrickomeara

Bug description

refs #11644 (comment)

The first response after the static cache is cleared, has server rendered content within nocache tags.

If the first request goes through a CDN such as cloudflare that response is cached at the edge. In my case the server rendered response contains region specific currency and pricing which is then being served in incorrect regions.

This is creating a race condition for us; when a request comes through between clearing the static cache and having it rewarmed.

Is there a way to disable this behaviour?

How to reproduce

  • clear the static cache
  • hit a url containing nocache through cloudflare
  • inspect the saved html on server (it will contain the correct nocache js and tags)
  • inspect the cloudflare cached result, it will have the nocache tags replaced by server rendered content

Logs

Environment

Environment
Application Name: Maintainly
Laravel Version: 12.49.0
PHP Version: 8.4.13
Composer Version: 2.9.5
Environment: production
Debug Mode: OFF
URL: maintainly.com
Maintenance Mode: OFF
Timezone: UTC
Locale: en

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

Drivers
Broadcasting: null
Cache: redis
Database: mysql
Logs: stack / single, slack, sentry, nightwatch
Mail: mailgun
Queue: redis
Session: redis

Storage
public/storage: NOT LINKED

Sentry
Enabled: YES
Environment: production
Laravel SDK Version: 4.20.0
PHP SDK Version: 4.19.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 1
Sites: 1
Stache Watcher: Disabled
Static Caching: full
Version: 5.70.0 PRO

Statamic Addons
statamic/seo-pro: 6.11.5

Installation

Existing Laravel app

Additional details

No response

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