Skip to content
WP Cloud
WP Cloud
    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management
    • PanelAlpha Integration: White-Label WordPress Control Panel for Hosts
    • EasyEngine Panel Integration: Visual WordPress Management for WP Cloud
    • FAQs
    • WP Cloud API
    • Partner Portal
    • Documentation
    • New Partner Guide
    • Pressable
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Impressive Hosting
    • Blog
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗
  • Solutions

    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Featured Partners

    Features

    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management

    Integrations

    • PanelAlpha Integration
    • Easy Engine Panel Integration

    Resources

    • Documentation
    • WP Cloud API
    • FAQs
    • Partner Portal
    • New Partner Guide
    • Announcements
    • Changelog
  • Case Studies
    • PressableA case study about how WP Cloud supports Pressable to power millions of page views daily.
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Newspack
    • Inverse Paradox
  • Insights
    • Podcast
    • BlogWP Cloud blog page with latest news and updates about the platform.
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗

Browse

    • WP Cloud platform overview
    • Onboard and launch with WP Cloud
    • WP Cloud Partner Portal
    • Get support from WP Cloud
    • WP Cloud glossary
    • API Documentation
    • Manage and secure API keys
    • Client SSH
    • WP Cloud API quick start
    • Webhooks
    • Run bulk tasks across sites
      • Manage site domains and aliases
      • Domain verification records
      • TLS certificates
      • Manage custom TLS certificates
      • Cloudflare and WP Cloud
    • Clone a site
    • Configure resources, site type, and billing with site meta
    • Delete a site
    • Persistent data
    • Staging sites
    • Migrate a site to WP Cloud
      • SSH and SFTP access models
      • Client SSH
      • User SSH and SFTP access
      • Database credentials
      • phpMyAdmin
      • ABSPATH
      • Default wp-config.php
      • Site constants
      • Configure redirects and headers with custom-redirects.php
      • Akismet and Jetpack
      • Blocked and unsupported plugins
      • PHP lifecycle and supported versions
      • Symlinks and managed software
      • WordPress versions
      • Install Composer and WP-CLI packages
      • Manage platform software with WP-CLI
      • Useful WP-CLI commands
    • Transactional email
    • WordPress multisite
    • Cron scheduling
    • Decoupled and headless WordPress
      • Edge Cache preload
      • WooCommerce cart caching
      • Page Cache
      • Edge Cache
      • Object Cache
      • Image transformation
      • Offload image sub-sizes
    • Configure lightweight 404s for static files
      • Edge Rules overview
      • Edge Rule types
      • Edge Rule conditions
      • Verify Edge Rules
      • Edge Cache preload
      • WooCommerce cart caching
      • Edge Cache
    • Edge request logs
      • DDoS protection
      • Defensive Mode
      • Rate limiting
      • Network and web application firewalls
      • Bot protection
      • Password protection
      • HTTP and security headers
      • PHP filesystem access permissions
      • Scan a site for malware
    • Backups overview
    • Create an on-demand backup
    • Restore a backup
    • Jetpack backups
      • Error logs
      • Web server logs
      • Edge request logs
    • Usage reporting
    • Metrics
    • Application performance monitoring
    • Automated failover
    • IP ranges
    • Origin and edge servers
    • Server specifications and settings
    • EasyEngine integration
    • PanelAlpha integration
      • White labelling and co-marketing WP Cloud
      • WP Cloud logos
      • Terms of Service & Compliance
      • Prohibited content
      • Copyright infringement and takedown notifications
    • WP Cloud billing
    • WP Cloud for agencies and site networks
    • WP Cloud partner support options
    • Troubleshoot Page and Edge Cache
    • Troubleshoot HTTP 429 and 599 errors
    • WP Cloud HTTP status codes
    • Troubleshoot site performance
    • Cache slow database queries
    • Troubleshoot duplicate core files, wp-config.php, and wp-admin 403 errors
    • Troubleshoot email delivery
    • Repair Yoast indexables
    • Troubleshoot PDF thumbnail generation
    • Troubleshoot TLS certificate provisioning

Updates

  • Changelog
  • WP Cloud Status
  • Announcements
Documentation/Security/Site security/HTTP and security headers

HTTP and security headers

LAST UPDATED

5 months ago

    HTTP headers carry information and instructions with a browser request or a server response. WP Cloud supplies platform headers for transport security, caching, and other managed behavior. WordPress code can add many application headers, but it cannot replace every platform-controlled value.

    A request header describes the browser and what it is asking for. For example:

    GET /support/ HTTP/1.1
    Host: example.com
    User-Agent: Mozilla/5.0
    Accept: text/html,application/xhtml+xml
    Accept-Language: en-US,en;q=0.5
    Cookie: wordpress_logged_in_example=value
    Cache-Control: no-cacheCode language: HTTP (http)

    The server answers with response headers before the response body:

    HTTP/1.1 200 OK
    Content-Type: text/html; charset=UTF-8
    Vary: Cookie
    Cache-Control: max-age=60, must-revalidate
    X-Frame-Options: SAMEORIGIN
    Strict-Transport-Security: max-age=15552000; preloadCode language: HTTP (http)

    The exact values depend on the URL, login state, cache state, site code, and WP Cloud services that handled the request. Inspect the response you need to change rather than copying a header set from another site.

    Common response headers

    HeaderPurposeSite code can set it?
    X-Robots-TagControls search-engine indexing for PHP-generated responses. It does not apply to static assets through the same path.Yes
    Access-Control-Allow-OriginIdentifies the origin whose frontend code may read a cross-origin response.Yes
    Access-Control-Allow-HeadersIdentifies request headers allowed by a CORS preflight response.Yes
    Access-Control-Allow-MethodsIdentifies methods allowed by a CORS preflight response.Yes
    Access-Control-Allow-CredentialsTells the browser whether frontend code may receive a response to a credentialed request.Yes
    Access-Control-Expose-HeadersIdentifies response headers that cross-origin frontend code may read.Yes
    X-Frame-OptionsRestricts framing to reduce clickjacking. WP Cloud returns SAMEORIGIN for wp-admin; frontend policy can be set by the site.Yes, for the frontend
    X-Content-Type-OptionsPrevents browsers from guessing a different MIME type.Yes
    Referrer-PolicyControls how much referrer information accompanies another request.Yes
    Content-Security-PolicyRestricts the origins from which a page may load scripts and other resources.Yes, with careful testing
    X-XSS-ProtectionControls an older browser XSS filter. Modern sites should rely on a tested Content Security Policy instead.Yes, but usually unnecessary
    Strict-Transport-SecurityTells browsers to use HTTPS. WP Cloud manages the base HSTS header.Only the supported subdomain and preload controls
    Cache-ControlControls browser and proxy caching. WP Cloud Page Cache and Edge Cache can supply this for cached responses.Not through Redirection or custom-redirects.php

    See MDN’s HTTP header reference for header syntax and browser behavior. Test security headers against every required frontend, API, embedded resource, and third-party integration. A strict CSP or CORS rule can break legitimate requests when its allowed origins or directives are incomplete.

    Add headers with a plugin

    The Redirection plugin can add response headers without creating a redirect:

    1. Open Tools → Redirection → Site in wp-admin.
    2. Find HTTP Headers and choose Add Header.
    3. Select where the header applies. Site is appropriate for most rules.
    4. Select a predefined header or choose a custom header and enter its value.
    5. Save the change and clear the applicable Page Cache, Edge Cache, and browser cache before testing.

    A name appearing in the plugin does not guarantee that WP Cloud permits it or that it can override a platform header.

    The plugin’s Location value controls where the rule applies. Site is usually appropriate for a site-wide response header. Its Header field contains common presets and a custom option; Value contains either the selected preset’s choices or a value supplied by the site owner. Adding a header here does not create a redirect.

    Add headers in custom-redirects.php

    Advanced integrations can set PHP response headers in custom-redirects.php:

    <?php
    
    header( 'X-Content-Type-Options: nosniff' );
    header( 'X-Frame-Options: SAMEORIGIN' );
    header( 'Referrer-Policy: no-referrer-when-downgrade' );Code language: HTML, XML (xml)

    Treat these as examples, not a complete security policy. Test the exact site and response paths. WP Cloud handles Cache-Control for cached HTML, so do not try to replace cache headers in custom-redirects.php.

    The file belongs in the site’s htdocs directory. A syntax error runs before WordPress and can affect every matching request, so keep the file small and test it on a staging site before copying it to production. See Configure redirects and headers with custom-redirects.php for file loading behavior and redirect examples.

    Check the response

    Request the exact public URL and inspect its response headers:

    curl -sS -D - -o /dev/null https://example.com/path/Code language: JavaScript (javascript)

    Run the request while logged out so WordPress login cookies do not change Page Cache or Edge Cache behavior. If the response can be cached, clear the relevant site and browser cache after changing a header, then request the URL more than once. Compare an origin response with an Edge Cache response when the header must be present in both.

    For CORS, test from the real requesting origin. A successful direct request or curl response does not prove that a browser will expose it to frontend code. Check the preflight response when the browser sends OPTIONS, and confirm that the allowed origin, method, headers, and credential behavior agree with the application. Avoid reflecting arbitrary origins when credentials are allowed.

    For Content Security Policy, start with a report-only policy when practical, review violations, and add only the origins and directives the application requires. Test wp-admin, login, REST API, forms, embeds, analytics, payment flows, and other third-party resources before enforcing it.

    Retest after a plugin, theme, or third-party service changes the resources a page loads. A header that was correct for an earlier version of the site can later block a required script, font, API request, frame, or payment flow. Keep the policy with the site code or configuration that depends on it so changes can be reviewed together.

    HSTS controls

    WP Cloud adds the HSTS header. Host partners can use the HSTS subdomain endpoint to toggle includeSubDomains. The public API also provides an endpoint to disable the preload directive.

    Do not enable includeSubDomains or browser preload until every present and future subdomain supports HTTPS. Browsers can remember the policy long after a site configuration changes.

    Previous Password protection
    Next PHP filesystem access permissions

    Related Guides

    • PHP filesystem access permissions

      Control whether PHP requests can write to a WP Cloud site’s filesystem with the php_fs_permissions…

      1 Min.

      READ

    • Scan a site for malware

      Run a one-site WP Cloud malware scan, monitor its response ticket and webhooks, and review…

      3 Min.

      READ

    On this page

      Contact support

      Contact us with Support issues and questions related to WP Cloud, the WP Cloud Atomic API, API-key IP allow list changes, Station, and more.

      Check the FAQs

      Have questions? Please visit our FAQ to learn more.

      An Automattic venture

      Work With Us

      Press

      Privacy Policy

      © 2021-2026 Automattic Inc.

      Notifications