Cloudflare Docs
Workers
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Examples

8 examples

  • Inspects the incoming request’s TLS version and blocks if under TLSv1.2.
  • Add the necessary CORS headers to a third party API response.
  • Protect sensitive data to prevent data loss, and send alerts to a webhooks server in the event of a data breach.
  • Block other websites from linking to your content. This is useful for protecting images.
  • Shows how to restrict access using the HTTP Basic schema.
  • Set common security headers (X-XSS-Protection, X-Frame-Options, X-Content-Type-Options, Permissions-Policy, Referrer-Policy, Strict-Transport-Security, Content-Security-Policy).
  • Verify a signed request using the HMAC and SHA-256 algorithms or return a 403.
  • Protect against timing attacks by safely comparing values using timingSafeEqual.