if (!(txn->req.flags & HTTP_MSGF_VER_11))
goto out;
- /* cache only GET method */
- if (txn->meth != HTTP_METH_GET)
+ /* cache only GET or OPTIONS method */
+ if (txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_OPTIONS)
goto out;
/* cache key was not computed */
ctx.blk = NULL;
switch (txn->meth) {
+ case HTTP_METH_OPTIONS:
+ chunk_memcat(trash, "OPTIONS", 7);
+ break;
case HTTP_METH_HEAD:
case HTTP_METH_GET:
chunk_memcat(trash, "GET", 3);
struct cache_flt_conf *cconf = rule->arg.act.p[0];
struct cache *cache = cconf->c.cache;
- /* Ignore cache for HTTP/1.0 requests and for requests other than GET
- * and HEAD */
+ /* Ignore cache for HTTP/1.0 requests and for requests other than GET,
+ * HEAD and OPTIONS */
if (!(txn->req.flags & HTTP_MSGF_VER_11) ||
- (txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_HEAD))
+ (txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_HEAD && txn->meth != HTTP_METH_OPTIONS))
txn->flags |= TX_CACHE_IGNORE;
http_check_request_for_cacheability(s, &s->req);