jonassiewertsen / statamic-livewire

A Laravel Livewire integration for Statamics antlers engine
83 stars 14 forks source link

419 Page Expired #63

Closed aerni closed 2 months ago

aerni commented 2 months ago

I've just deployed a website that uses v3.4.0, and I'm running into Livewire's infamous 419 Page Expired issue when full static caching is on. It looks like PR https://github.com/jonassiewertsen/statamic-livewire/pull/61 might have some unforeseen side effects. I didn't run into this issue when testing the new replacer feature locally with Herd. I'll look into this and try to fix it.

aerni commented 2 months ago

Okay, so it turns out that Herd doesn't include Valet's Statamic driver that takes care of full static caching. So it would always run PHP instead of only loading the static HTML, which is why I didn't catch the 419 locally. Now I run into the same issue locally and can debug 💪

marcorieser commented 2 months ago

@aerni how have you enabled the Statamic driver in Herd?

aerni commented 2 months ago

Add this driver by following these instructions.

aerni commented 2 months ago

Alright, so the 419 is triggered because I'm accessing this.$wire before the STATAMIC_CSRF_TOKEN placeholder is replaced with the current CSRF token. I'll have to find a workaround for that issue on my end.

But this is a separate issue to full static caching not working correctly with the current implementation of the AssetsReplacer. I'll figure out a different approach to make it work with both half and full measure static caching.

marcorieser commented 2 months ago

Add this driver by following these instructions.

Thanks. I reported an issue on the Herd repo which gets fixed in next release. Shouldn't be needed then. https://github.com/beyondcode/herd-community/issues/812