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' );
Related Posts:
- Nginx + WordPress + HHVM: Why isn’t Batcache working? Would Varnish help even more?
- Varnish + W3 Total Page Cache [closed]
- Getting soft 404 errors (200 status) when caching plugins are enabled
- Last-Modified header support doesnât speed up server processing – want more
- dynamic page not displaying correctly when Varnish hosting ignores query string parameters
- WordPress mobile version is not responsive anymore after installing varnish
- WordPress varnish pages printed twice
- Is define(‘WP_CACHE’, true) needed for object caching?
- Pros and Cons for high “expire time” on wp-super-cache or w3-total-cache? [closed]
- Limit cache size from W3 Total Cache [closed]
- Configuring WordPress for Amazon CloudFront Caching?
- Caching: Force fresh content for logged-in users (potentially by adding a query variable to the URL)
- Will I see a performance hit if I use native API calls like get_the_title() instead of $post->post_title?
- WordPress Browser Cache with W3-Total-Cache doesn’t show new posts [closed]
- Does a low traffic WordPress site need a caching plugin and a CDN
- Automatically Refresh WordPress Stylesheet
- How to use cache with simplepie
- Fragment caching increasing database queries
- Can I force get_option to go back to the DB instead of cache?
- Stale cache handling with a persistent object cache
- Setting Last Modified HTTP Header on static Home Page
- Settings to get the most out of W3 Total Cache
- Help Pinpointing Source of Caching Issue
- How to clear cache without a plugin [closed]
- can’t see live version of style.css – is it web server caching?
- wp-super-cache exclude file from caching
- APC object caching in combination Batcache/memcached page caching?
- Should the page cache be refreshed often? [closed]
- Plugin a specific cache functionality?
- Check if a user is connected and get is ID without fully loading wordpress
- Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]
- Database Cache and Object Cache Difference?
- Register script version not showing
- When use a cache system with WordPress
- Optimizing Jetpack for WordPress [closed]
- How do I fetch feed info from cache instead of directly from feed?
- Transients are not expiring as expected in simple custom plugin
- Prevent installation of style.css cookies and file caching
- How to speed up my site [duplicate]
- Headway body classes and W3TC page cache conflict [closed]
- How can I cache the LearnDash quizzes on my server?
- Disable feed cache for custom RSS feed?
- How do I enable dynamic content in a theme cached with WP Super Cache?
- WP_Object_Cache for heavy WP_Query
- How to decode wordpress transient cache stored in database?
- WordPress PHP 5.5 and OPcache
- Batcache messages no longer in page source
- After having installed APC Object Cache Backend transients stopped working
- Fixed version number for cached stylesheets and javascript
- Are get_bloginfo queries cached to start, or should they be cached?
- Is it duplicated if I cache an object that uses data from postmeta?
- How does WP’s cache maintain persistence through page reloads?
- How to clear user’s browser cache after publishing a new post?
- Any idea why Google not caching my site? [closed]
- Combile External JS files using W3 Total Cache [closed]
- Gravity forms / Recaptcha / Autoptimize – somewhere it goes wrong
- How to solve minify js and css first time load delay?
- How to get Caching Plug-ins to work on localhost with HTTPS?
- WordPress website not showing changes without clearing cache
- Cloud flare, cache, minify question [closed]
- How can I cache font files on WordPress [closed]
- W3 total – leverage browser caching not working with cdn delivered images [closed]
- Cache WordPress for offline use
- issues with object cache (memcached as backend) and wpmu when flush_all is run
- Scheduling doesn’t work due to caching?
- APC fragmention woes on Apache AWS EC2 Small instance with WordPress and W3TC [closed]
- How to get the URL of a sitemap that contains a certain post?
- Best practices for the cache of a static WordPress site, including CDN Cache and Cache Plugin
- Site’s first loading on a new browser with no cache is messed up
- How to not cache nonces with WP Rocket?
- Site speed slows when user logged in
- Password Protected Pages Don’t Accept A Valid Password After Changing The Password
- Clear cache when comment is added
- Way to prevent snippet of template from being cached?
- How to make login / logout links cache independent?
- Non Admins Getting Cached Posts
- Why WordPress cache is not available after reload page?
- WordPress on mobile devices with new data after updating page
- New blog posts don’t update on page – How to force update of cookies more frequently?
- Having issues fixing site speed
- Is there a way to cache WordPress that does not loads core?
- PHP Fatal Error in cache.php on line 123 $wp_object_cache is non-object
- No Query String vs Ignore Query String in WordPress
- w3 total cache uninstall remove cache
- FATAL ERROR – white page – no site showing
- Popular posts with Varnish ESI
- Completely reload style.css
- Page wrongly displayed when cache plugin activated
- GravatarLocalCache Plugin Broken in WordPress 4.2
- Serve content from centralized location
- My website resets when accessing the index page
- Major cache but only on WordPress site
- Debug Performance Issues
- User cannot authenticate after signup when object cache enabled
- WP 3.5 caching problem
- Multiple WordPress sites eat up a lot of RAM
- Convert WordPress to static website by using the pages generated by the caching plugin?
- Cannot add version of main.css to wordpress on testing enviroment
- How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?
- Why does enabling caching break password protected pages? Is there a way around this?