JavaScriptMedium
What are some common security headers and their purpose?
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
Security headers are HTTP response headers that help protect web applications from various attacks. Some common security headers include:
Content-Security-Policy (CSP): Prevents cross-site scripting (XSS) and other code injection attacks by specifying allowed content sources.X-Content-Type-Options: Prevents MIME type sniffing by instructing the browser to follow the declaredContent-Type.Strict-Transport-Security (HSTS): Enforces secure (HTTPS) connections to the server.X-Frame-Options: Prevents clickjacking by controlling whether a page can be displayed in a frame.X-XSS-Protection: Enables the cross-site scripting (XSS) filter built into most browsers.Referrer-Policy: Controls how much referrer information is included with requests.
