Title: Custom Headers
Last modified: March 15, 2017

---

# Custom Headers

 *  [ungeruehrt](https://wordpress.org/support/users/ungeruehrt/)
 * (@ungeruehrt)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/custom-headers-7/)
 * Hi,
 * I’m adding some header information via action ‘send_headers’ in my functions.
   php:
 * `add_action( 'send_headers', 'serverpush' );`
 * Those information are implemented for Server Push and Strict Transport Security:
 *     ```
       function serverpush() {
       	header( "Link: </wp-content/themes/tibor/critical-min.css>; rel=preload; as=style, </wp-content/themes/tibor/fonts-subset/affogato-light.woff2>; rel=preload; as=font; type='font/woff2'; crossorigin, </wp-content/themes/tibor/fonts/sourcesanspro-regular-webfont.woff2>; rel=preload; as=font; type='font/woff2'; crossorigin" );
       header("strict-transport-security: max-age=2592000; includeSubDomains");
       }
       ```
   
 * When I activate WP Super Cache, those headers are not send anymore.
    Is there
   a way to fix this?
 * Kind regards
 * Tibor

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [nwoetzel](https://wordpress.org/support/users/nwoetzel/)
 * (@nwoetzel)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/custom-headers-7/#post-8924829)
 * Hi Tibor,
 * I have the same problem. If you really need it, you could add it on the server
   level (apache/nginx). Probable solution for worpdress with cache is on the bottom
   of this comment – but here is my analysis:
    The [https://wordpress.org/plugins/security-headers/](https://wordpress.org/plugins/security-headers/)
   uses the same mechanism (action: send_headers) and fails, when the page is served
   from cache. The user note to the wp_headers (a filter called in send_headers)
   at [https://developer.wordpress.org/reference/hooks/wp_headers/#user-contributed-notes](https://developer.wordpress.org/reference/hooks/wp_headers/#user-contributed-notes)
   mentions that the send_headers is just not called for cached content. But I do
   not like the “meta http-equiv” tag to fix the problem with the headers.
 * So my best guess is to hook into the ‘template_redirect’ action like demonstrated
   in the “cache-control” plugin: [https://plugins.svn.wordpress.org/cache-control/tags/1.2/cache-control.php](https://plugins.svn.wordpress.org/cache-control/tags/1.2/cache-control.php)
 * Having other priorities, I cannot test that right now, but I can imagine that
   this works. If it is the right/correct solution – I cannot tell.
 * Best
    Nils
 *  Thread Starter [ungeruehrt](https://wordpress.org/support/users/ungeruehrt/)
 * (@ungeruehrt)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/custom-headers-7/#post-8928159)
 * Thanks for your inout!
    I tried `add_action('template_redirect', 'serverpush')`
   instead. Now my headers are added to the response header, but the `wp-super-cache`-
   Header is missing. I guess, the caching is completely deactivated then?
 * Kind regards
 * Tibor

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Headers’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [http-header](https://wordpress.org/support/topic-tag/http-header/)

 * 2 replies
 * 2 participants
 * Last reply from: [ungeruehrt](https://wordpress.org/support/users/ungeruehrt/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/custom-headers-7/#post-8928159)
 * Status: not resolved