flawopen.com/Reference/Next.js Server Actions CSRF
Yes, by default. Next.js Server Actions verify the Origin header against the Host header on all POST requests. If an attacker's site tries to trigger a server action on behalf of a logged-in user, Next.js blocks the request automatically.
When a Next.js Server Action is invoked, the browser sends an HTTP POST request. Next.js checks whether the incoming Origin header matches the application's Host header. If they do not match, the action is rejected with a 403 Forbidden error.
If you specify wildcards or trust external subdomains in experimental.serverActions.allowedOrigins, a compromised subdomain can issue cross-site action calls.
If your reverse proxy (Nginx, AWS ALB) forwards an untrusted X-Forwarded-Host header to Next.js without validation, the Origin check can be deceived.
X-Forwarded-Host and Host strictly to verified domain names.allowedOrigins.SameSite=Lax or SameSite=Strict.