diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index 31d06fcb602..d8ce2db37df 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -664,6 +664,14 @@ HttpHeader::parse(const char *header_start, size_t hdrLen, Http::ContentLengthIn } } + if (Config.onoff.ignore_vary) { + String rawVary; + if (getByIdIfPresent(Http::HdrType::VARY, &rawVary)) { + delById(Http::HdrType::VARY); + debugs(55, 5, "Ignoring Vary: " << rawVary); + } + } + return 1; /* even if no fields where found, it is a valid header */ } diff --git a/src/SquidConfig.h b/src/SquidConfig.h index ae2d72cc763..5e6939bdfa7 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -310,6 +310,7 @@ class SquidConfig #endif int vary_ignore_expire; + int ignore_vary; int surrogate_is_remote; int detect_broken_server_pconns; int relaxed_header_parser; diff --git a/src/cf.data.pre b/src/cf.data.pre index 898fc9af48d..418921b8230 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -6969,6 +6969,24 @@ DOC_START varying objects not intended for caching to get cached. DOC_END +NAME: ignore_vary +COMMENT: on|off +TYPE: onoff +LOC: Config.onoff.ignore_vary +DEFAULT: off +DOC_START + Some HTTP servers send a Vary header even though the clients + never send requests with different request headers. This + option causes Squid to completely ignore the Vary header and + go ahead and cache the response using normal rules. + + WARNING: Doing this this VIOLATES the HTTP standard. Enabling + this can cause varying responses not intended for caching to get + cached. It is intended as a workaround until HTTP/1.1 is fully + implemented and only for use when client behavior is fully + controlled. +DOC_END + NAME: request_header_access IFDEF: USE_HTTP_VIOLATIONS TYPE: http_header_access