I’m still a beginner in creating Laravel Livewire applications, how to make CSP allow livewire.js
When I don’t use Content Security Policy Livewire runs fine, after I use Content Security Policy with spatie livewire.js is blocked, what is the solution?
I have used several methods
@livewireStyles(['nonce' => csp_nonce() ])
and
@livewireScripts(['nonce' => csp_nonce() ])
but it still doesn’t work
2
Answers
You may have added the nonces to livewire correctly, the problem seems to be that the livewire script itself is not allowed to run by the existing policy. You can do this by:
use this code