It appears that all requests sent using the HEAD method are passed on to the backend servers, which can make a site easy to overload with a flurry of this type of request.
According to Cloudflare's docs,
cache.put will throw an error if:
- The request passed is a method other than GET.
This is in contrast with Cloudflare's default behaviour for caching HEAD requests:
When you make a HEAD request for a cacheable resource and Cloudflare does not have that resource in the edge cache, a cache miss happens. Cloudflare will send a GET request to your origin, cache the full response and return the response headers only.
To verify this behaviour on a site using the worker, compare the cf-cache-status header returned for a request made with GET:
curl -v [URL] 2>&1 | grep "cf-cache-status"
# < cf-cache-status: HIT - at least from the second request onwards
with the same request made with HEAD:
curl --head -v [URL] 2>&1 | grep "cf-cache-status"
# < cf-cache-status: DYNAMIC - always
It appears that all requests sent using the
HEADmethod are passed on to the backend servers, which can make a site easy to overload with a flurry of this type of request.According to Cloudflare's docs,
This is in contrast with Cloudflare's default behaviour for caching HEAD requests:
To verify this behaviour on a site using the worker, compare the
cf-cache-statusheader returned for a request made withGET:with the same request made with
HEAD: