Skip to content

Instantly share code, notes, and snippets.



Last active Aug 1, 2017
What would you like to do?
Cache AJAX GET Requests in Varnish
sub vcl_recv {
# Possibility to cache admin-ajax GET requests
if ((req.url ~ "admin-ajax.php") && !req.http.cookie ~ "wordpress_logged_in" ) {
return (hash);
#set the length of time to cache ajax GET requests
if ((bereq.url ~ "admin-ajax.php") && !bereq.http.cookie ~ "wordpress_logged_in" ) {
unset beresp.http.set-cookie;
set beresp.ttl = 1d;
set beresp.grace = 1d;

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.