Web Security

What Is Security Headers?

HTTP response headers that instruct browsers how to handle your website's content securely. They protect against common attacks like cross-site scripting (XSS), clickjacking, and protocol downgrade attacks by telling the browser what actions are allowed.

In Laravel Applications

Laravel does not set security headers by default. You need to add them via middleware. Key headers include Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, X-Content-Type-Options, and Referrer-Policy.

Example

Adding `X-Frame-Options: DENY` prevents your Laravel application from being embedded in an iframe, blocking clickjacking attacks.

Related Terms

Related Articles

Monitor Your Laravel Application's Security

StackShield continuously checks your Laravel application from the outside, catching security issues before attackers find them.

Start Free Trial