fdiary commented on issue #7417:
URL: https://github.com/apache/trafficserver/issues/7417#issuecomment-757866872


   I would like to propose the following patch that perfectly solves this issue.
   ```
   --- trafficserver-8.1.1/proxy/http/HttpTransact.cc.orig 2020-12-01 
00:30:26.000000000 +0100
   +++ trafficserver-8.1.1/proxy/http/HttpTransact.cc      2021-01-11 
11:35:41.946893735 +0100
   @@ -5752,6 +5752,7 @@
    HttpTransact::is_stale_cache_response_returnable(State *s)
    {
      HTTPHdr *cached_response = s->cache_info.object_read->response_get();
   +  HTTPStatus cache_response_code = cached_response->status_get();
    
      // First check if client allows cached response
      // Note does_client_permit_lookup was set to
   @@ -5760,6 +5761,12 @@
      if (!s->cache_info.directives.does_client_permit_lookup) {
        return false;
      }
   +  // We don't serve stale negative cache.
   +  if (cache_response_code == HTTP_STATUS_INTERNAL_SERVER_ERROR || 
cache_response_code == HTTP_STATUS_GATEWAY_TIMEOUT ||
   +      cache_response_code == HTTP_STATUS_BAD_GATEWAY || cache_response_code 
== HTTP_STATUS_SERVICE_UNAVAILABLE) {
   +    TxnDebug("http_trans", "[is_stale_cache_response_returnable] stale 
negative cache");
   +    return false;
   +  }
      // Spec says that we can not serve a stale document with a
      //   "must-revalidate header"
      // How about "s-maxage" and "no-cache" directives?
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to