HTTP Security Header Checker

ตรวจสอบสถานะและรับคำแนะนำในการตั้งค่า HTTP Security Headers เพื่อเพิ่มความปลอดภัยให้กับเว็บไซต์

Understanding HTTP Security Headers

HTTP Security Headers are key-value pairs returned by your web server that instruct browsers how to behave when handling your site's content. They're essential for protecting against common security vulnerabilities.

Learn more from OWASP's HTTP Headers Cheat Sheet

CORS (Cross-Origin Resource Sharing)

CORS is a mechanism that allows web pages from one domain to securely request data from another domain. It controls access through HTTP headers like Access-Control-Allow-Origin.

Example:

Access-Control-Allow-Origin: https://example.com

Cache-Control

Cache-Control defines caching policies for browsers and proxy servers. It can prevent caching sensitive data or specify cache duration.

Example:

Cache-Control: no-cache, no-store, must-revalidate

HSTS (HTTP Strict-Transport-Security)

HSTS forces browsers to communicate with the server only via HTTPS, preventing SSL Stripping attacks.

Example:

Strict-Transport-Security: max-age=31536000; includeSubDomains

X-Frame-Options

X-Frame-Options prevents your website from being loaded within an iframe on another website, protecting against clickjacking attacks.

Example:

X-Frame-Options: SAMEORIGIN

Content-Security-Policy (CSP)

CSP protects against XSS and code injection attacks by specifying which sources content can be loaded from.

Example:

Content-Security-Policy: default-src 'self'

X-Content-Type-Options

X-Content-Type-Options prevents browsers from MIME sniffing and forces them to use the content type specified by the server.

Example:

X-Content-Type-Options: nosniff

Referrer-Policy

Referrer-Policy controls how much referrer information is shared when navigating to other websites.

Example:

Referrer-Policy: strict-origin-when-cross-origin

Permissions-Policy

Permissions-Policy controls which browser features and APIs can be used in your website and embedded content.

Example:

Permissions-Policy: geolocation=(), microphone=()

Security Best Practices

  • Always enable HTTPS (HSTS) to prevent man-in-the-middle attacks
  • Implement Content-Security-Policy to prevent XSS attacks
  • Use X-Frame-Options to prevent clickjacking attacks
  • Set X-Content-Type-Options: nosniff to prevent MIME sniffing
  • Configure CORS headers appropriately for your API endpoints
  • Review and test your security headers regularly

Vulnerabilities Prevented

XSS (Cross-Site Scripting):Mitigated by CSP and X-XSS-Protection

Clickjacking:Prevented by X-Frame-Options

MIME Sniffing:Blocked by X-Content-Type-Options

SSL Stripping:Protected by HSTS

Man-in-the-Middle Attacks:Prevented by HTTPS enforcement and certificate pinning