trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emanuele Rocca <...@wikimedia.org>
Subject 503 responses without Cache-Control get cached if Negative Response Caching is enabled
Date Mon, 13 May 2019 09:49:01 GMT
Hi,

my understanding of Negative Response Caching is that, by default, ATS
does not cache negative responses such as 404 and 503 unless the
response includes a Cache-Control value that allows caching. From
https://docs.trafficserver.apache.org/en/8.0.x/admin-guide/files/records.config.en.html#proxy-config-http-negative-caching-enabled:

> When disabled (0), Traffic Server will only cache the response if the
> response has Cache-Control headers.

The list of status codes that are considered negative responses can be
configured by changing proxy.config.http.negative_caching_list.

Given the following configuration changes, I would thus expect 503 responses
without Cache-Control not to be cached:

	proxy.config.http.cache.required_headers has changed
		Current Value   : 1
		Default Value   : 2
	proxy.config.http.negative_caching_enabled has changed
		Current Value   : 1
		Default Value   : 0
	proxy.config.http.negative_caching_list has changed
		Current Value   : 404 414
		Default Value   : 204 305 403 404 405 414 500 501 502 503 504

However, the following 503 response does get cached:

	< HTTP/1.0 503 SERVICE UNAVAILABLE
	< Content-Type: text/html; charset=utf-8
	< Content-Length: 6
	< Server: Werkzeug/0.14.1 Python/2.7.16
	< Date: Mon, 13 May 2019 09:29:39 GMT
	<
	error

Relevant debug logs:

	{0x7fd040f16700} DEBUG: <HttpTransact.cc:3797 (handle_forward_server_connection_open)>
(http_trans) [3] [hfsco] cache action: CACHE_DO_WRITE
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:3926 (handle_cache_operation_on_forward_server_response)>
(http_trans) [3] [handle_cache_operation_on_forward_server_response] (hcoofsr)
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:6006 (is_response_cacheable)> (http_trans)
[3] [is_response_cacheable] client permits storing
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:3936 (handle_cache_operation_on_forward_server_response)>
(http_trans) [3] [hcoofsr] response is cacheable
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:4079 (handle_cache_operation_on_forward_server_response)>
(http_trans) [3] [hcoofsr] response code: 503
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:248 (is_negative_caching_appropriate)> (http_trans)
[3] 503 is NOT eligible for negative caching
	{0x7fd040f16700} DEBUG: <HttpTransact.cc:4269 (handle_cache_operation_on_forward_server_response)>
(http_trans) [3] [hcoofsr] cache write

Am I right in expecting that 503 responses without Cache-Control should not get
cached given the configuration above? If so, I'll file a bug.

Thanks,
  Emanuele

Mime
View raw message