Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Varnish with WordPress

I gave it a punt and it seems to be OK. Below is my VCL. It basically unsets all cookies unless it’s wp-admin. This will only work for a very simple site.

# Specific to my.website.com
if (bereq.http.host == "my.website.com") {
        # Strip all cookies (the only one should be PHPSESSID) if not admin
        if ( ! bereq.url ~ "^/wp-admin/") {
                unset beresp.http.Set-Cookie;
        }
}

Related Posts:

  1. How can I use Varnish Edge Side includes for a sidebar?
  2. Prevent WordPress from sending Cache-control http header
  3. Nginx + WordPress + HHVM: Why isn’t Batcache working? Would Varnish help even more?
  4. Varnish + W3 Total Page Cache [closed]
  5. Separating HTTP and HTTPS content with WordPress, Varnish, and an SSL terminator?
  6. WordPress + SSL + Varnish + Pound
  7. Large Woocommerce Site (83,000 items), What Can I Do? [closed]
  8. Why does WP HTTP API switch the method (POST/PURGE) to GET when redirecting (302)?
  9. dynamic page not displaying correctly when Varnish hosting ignores query string parameters
  10. WordPress mobile version is not responsive anymore after installing varnish
  11. WordPress varnish pages printed twice
  12. Popular posts with Varnish ESI
  13. WordPress on Nginx – Missing admin/toolbar
  14. Varnish + Nginx for WordPress is Good?
  15. Why would changing ports from 80 to 8080 cause wordpress to act unexpectedly?
  16. How to set up Nginx as a caching reverse proxy?
Categories varnish Tags varnish
Disable wordpress from including jQuery in the head section
Custom url for a single page

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress