Response
HTTP Content-Security-Policy (CSP) Header
Controls which resources the browser is allowed to load. A critical security header that prevents XSS and data injection attacks.
Purpose
Enhances website security by defining approved sources of content that the browser can load, preventing cross-site scripting attacks.
Content-Security-Policy: <policy-directive> <source> Example: Content-Security-Policy: default-src 'self' Example: Content-Security-Policy: script-src 'self' https://apis.google.com; img-src 'self' data:
Code Examples
See how to use the Content-Security-Policy (CSP) header in different tools and languages.
Related Headers
Test Your APIs
content-security-policy headerhttp content-security-policyhttp headers guide