• Hello

    I added HTTP headers in functions.php inside my theme. For example:
    Strict-Transport-Security
    X-Frame-Options
    X-XSS-Protection
    X-Content-Type-Options
    Feature-Policy
    Referrer-Policy

    Also, I checked “Cache HTTP headers with page content”.
    I noticed that HTTP header Feature-Policy is not cached. So, when any page is “live” HTTP header have all headers above, but when page is cached by WP Super Cache, Feature-Policy HTTP header is missing.

    Also, I tried to open some meta-wp-cache-nnnnnnnnnnnnnn.php file to check it, and I can see that there is no Feature-Policy HTTP header in it, and I do not know why?

    How to tell WP Super Cache to cache HTTP header “Feature-Policy” too?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sa?a

    (@stodorovic)

    Hello @jole5,

    There are an issue in PHP which could be related to your issue. You could see more details – https://github.com/Automattic/wp-super-cache/pull/618.

    Anyway, the header Feature-Policy isn’t in the list of known headers. You should use the filter wpsc_known_headers to add this header. I could sent exact PHP code If you need it.

    Regards,
    Sa?a

    Thread Starter Advanced SEO

    (@jole5)

    Hello Sa?a.

    Thank you for reply. If I right, problem is with apache_response_headers which does not work properly in PHP 7.x. I am using PHP 7.x, but my site is not on Apache.

    Could you please send me exact PHP code?

    Thank you.

    Sa?a

    (@stodorovic)

    It’s possible that other servers use sapi CGI (nginx FCGI for example), but you know for possible issue. Also you could apply #618 if you experience issue related to the function apache_response_headers (which isn’t used only on apache).

    PHP code:

    add_filter( 'wpsc_known_headers', 'my_wpsc_custom_headers' );
    
    function my_wpsc_custom_headers( $headers ) {
            $headers[] = 'Feature-Policy';
    
            return $headers;
    }
    

    It seems that other headers are already on the list, so I think that this code should fix your issue.

    Thread Starter Advanced SEO

    (@jole5)

    Hello Sa?a.

    Thank you for your reply, and for PHP code. It is working fine now.
    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP Super CAche do not cache Feature-Policy header’ is closed to new replies.