Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Maso's avatar
Level 13

How to add nonce in Inertia

Hi, I use Laravel 8 / Inertia and i want to use spatie/laravel-csp to provide CSP.

How to add nonce in @routes in app.blade.php?

@routes(false, {{ csp_nonce() }}) doesn't work

0 likes
1 reply
Naumancs's avatar

I hope you were able to solve this, but you don'e need {{}} in blade directives, so @routes(null, csp_nonce()) should work fine. or if you are on PHP 8.x then @routes(nonce: csp_nonce())

Please or to participate in this conversation.