CM
Essential security headers for Laravel apps - checklist
Here is the security headers checklist I use for every Laravel project. You can add these in middleware or via your web server config.
Must-have headers:
- X-Content-Type-Options: nosniff
- X-Frame-Options: SAMEORIGIN
- Referrer-Policy: strict-origin-when-cross-origin
- Permissions-Policy: camera=(), microphone=(), geolocation=()
- Strict-Transport-Security: max-age=31536000; includeSubDomains
Content Security Policy is trickier and needs to be tailored per app. Start strict and loosen as needed. At minimum set default-src to self.
Test your headers using securityheaders.com to check your score. Aim for A+ grade.
What other security practices do you follow in your Laravel apps?