Prevent WordPress from sending Cache-control http header

Thanks to @chrisguitarguy’s answer, you can control the http headers sent by WordPress via the “send_headers” hook. Here is the function I added to my theme’s functions.php file, and that solved the issue with the Varnish server.

function varnish_safe_http_headers() {
    header( 'X-UA-Compatible: IE=edge,chrome=1' );
    session_cache_limiter('');
    header("Cache-Control: public, s-maxage=120");
  if( !session_id() )
  {
    session_start();
  }
}
add_action( 'send_headers', 'varnish_safe_http_headers' );

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)