diff --git a/doc/configuration.txt b/doc/configuration.txt index cbea3309d..223184b2c 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -17265,6 +17265,7 @@ The cache won't store and won't deliver objects in these cases: - If the request is not a GET - If the HTTP version of the request is smaller than 1.1 +- If the request contains an Authorization header Caution!: Due to the current limitation of the filters, it is not recommended to use the cache with other filters. Using them can cause undefined behavior diff --git a/src/proto_http.c b/src/proto_http.c index 3adb54f23..efa6d6a36 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7737,6 +7737,15 @@ void check_request_for_cacheability(struct stream *s, struct channel *chn) } } + /* Don't use the cache and don't try to store if we found the + * Authorization header */ + val = http_header_match2(cur_ptr, cur_end, "Authorization", 13); + if (val) { + txn->flags &= ~TX_CACHEABLE & ~TX_CACHE_COOK; + txn->flags |= TX_CACHE_IGNORE; + continue; + } + val = http_header_match2(cur_ptr, cur_end, "Cache-control", 13); if (!val) continue;