cms icon indicating copy to clipboard operation
cms copied to clipboard

{nocache} tag and 404 pages

Open ryanmitchell opened this issue 3 years ago • 1 comments

Bug description

Using {nocache} in a layout means that on 404 pages we see a lot of {NOCACHE_PLACEHOLDER} being output instead of what we wanted not to be cached.

It seems the middleware is not being run?

How to reproduce

Add {nocache} to your layout and hit a 404 page on your install.

Logs

No response

Environment

Statamic 3.3.29 Pro
Laravel 8.83.23
PHP 8.1.7
aerni/social-links 2.3.1
cnj/seotamic 2.0.6
doublethreedigital/duplicator 2.3.1
mitydigital/iconamic 1.0.2
pecotamic/sitemap 1.4.0
thoughtco/statamic-minify 1.1.1
thoughtco/statamic-redirects 1.1.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

runtime (new)

Additional details

No response

ryanmitchell avatar Aug 22 '22 13:08 ryanmitchell

Confirmed.

jasonvarga avatar Sep 15 '22 18:09 jasonvarga

Just hit this one myself

mikemartin avatar Sep 27 '22 10:09 mikemartin

Me too. Would be nice if the nocache tag just fell back to the partial when static caching isn't available, but that's apparently more complicated than it seems. #https://github.com/statamic/cms/issues/6744

Also, weirdly it seems the statamic.web middleware is being applied to my error pages so I don't understand why NO_CACHE_PLACEHOLDER is being shown:

@dump(Route::current()->gatherMiddleware())

^ array:2 [▼
  0 => "web"
  1 => "statamic.web"
]

stuartcusackie avatar Oct 05 '22 14:10 stuartcusackie