Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

419 errors using the nocache tag #10068

Closed
robdekort opened this issue May 14, 2024 · 2 comments · Fixed by #10070
Closed

419 errors using the nocache tag #10068

robdekort opened this issue May 14, 2024 · 2 comments · Fixed by #10070
Assignees
Labels

Comments

@robdekort
Copy link
Contributor

Bug description

On two v5 sites where I use the nocache tag I get 419 console errors on the /!/nocache route. This leads to the content not being rendered on production sites.

How to reproduce

Use nocache with static caching

Logs

No response

Environment

Environment
Laravel Version: 11.7.0
PHP Version: 8.2.18
Composer Version: 2.7.6
Environment: staging
Debug Mode: OFF
Maintenance Mode: OFF

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

Drivers
Broadcasting: log
Cache: statamic
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Livewire
Livewire: v3.4.12

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

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.1
jonassiewertsen/statamic-livewire: 3.3.1
rias/statamic-color-swatches: 2.3.0
stillat/relationships: 2.2.0
studio1902/statamic-peak-browser-appearance: 3.4.0
studio1902/statamic-peak-commands: 8.3.0
studio1902/statamic-peak-seo: 8.13.2
studio1902/statamic-peak-tools: 6.0.0

Installation

Starter Kit using via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

I've opened a PR to fix the issue which should hopefully be released soon. In the meantime, you can add this to your bootstrap/app.php file:

->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        '!/nocache',
    ]);
})

@robdekort
Copy link
Contributor Author

Amazing. Thanks for this. The workaround works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants