mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-22 14:49:45 -04:00
Revert "MINOR: cache: allow caching of OPTIONS request"
This reverts commit 1263540fe8.
As discussed in issues #214 and #251, this is not the correct way to
cache CORS responses, since it relies on hacking the cache to cache
the OPTIONS method which is explicitly non-cacheable and for which
we cannot rely on any standard caching semantics (cache headers etc
are not expected there). Let's roll this back for now and keep that
for a more reliable and flexible CORS-specific solution later.
This commit is contained in:
parent
4c52e4b560
commit
6905d18495
1 changed files with 5 additions and 8 deletions
13
src/cache.c
13
src/cache.c
|
|
@ -563,8 +563,8 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px,
|
|||
if (!(txn->req.flags & HTTP_MSGF_VER_11))
|
||||
goto out;
|
||||
|
||||
/* cache only GET or OPTIONS method */
|
||||
if (txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_OPTIONS)
|
||||
/* cache only GET method */
|
||||
if (txn->meth != HTTP_METH_GET)
|
||||
goto out;
|
||||
|
||||
/* cache key was not computed */
|
||||
|
|
@ -1069,9 +1069,6 @@ int sha1_hosturi(struct stream *s)
|
|||
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);
|
||||
|
|
@ -1107,10 +1104,10 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p
|
|||
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,
|
||||
* HEAD and OPTIONS */
|
||||
/* Ignore cache for HTTP/1.0 requests and for requests other than GET
|
||||
* and HEAD */
|
||||
if (!(txn->req.flags & HTTP_MSGF_VER_11) ||
|
||||
(txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_HEAD && txn->meth != HTTP_METH_OPTIONS))
|
||||
(txn->meth != HTTP_METH_GET && txn->meth != HTTP_METH_HEAD))
|
||||
txn->flags |= TX_CACHE_IGNORE;
|
||||
|
||||
http_check_request_for_cacheability(s, &s->req);
|
||||
|
|
|
|||
Loading…
Reference in a new issue