Automattic / batcache

A memcached HTML page cache for WordPress.
http://wordpress.org/extend/plugins/batcache/
284 stars 104 forks source link

Exempt PUT, PURGE, and DELETE requests #67

Closed zamoose closed 7 years ago

zamoose commented 8 years ago

By default, PUT requests aren't exempted from Batcache. This causes... issues with WP-API/JSON, especially when using Basic auth, as there's no cookie to override and cause a bypass. Suggest we bypass for PUT, PURGE, and DELETE requests.

Insert at advanced-cache.php line 229:

// Never batcache on PUT request.
 if ('PUT' === $_SERVER['REQUEST_METHOD'] || 'PURGE' === $_SERVER['REQUEST_METHOD'] || 'DELETE' === $_SERVER['REQUEST_METHOD']) {
    return;
 }

I'll put an actual PR in for this too.

Props to @allan23 for working this up.

joshbetz commented 8 years ago

We probably shouldn't cache anything that's not HEAD or GET.