--- 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?
