Index: modules/http/http_filters.c =================================================================== --- modules/http/http_filters.c (revision 1523591) +++ modules/http/http_filters.c (working copy) @@ -1610,9 +1610,12 @@ apr_status_t ap_http_outerror_filter(ap_filter_t * * Start of error handling state tree. Just one condition * right now :) */ - if (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY) { + switch (((ap_bucket_error *)(e->data))->status) { + case HTTP_BAD_GATEWAY: + case HTTP_GATEWAY_TIME_OUT: /* stream aborted and we have not ended it yet */ r->connection->keepalive = AP_CONN_CLOSE; + break; } continue; } Index: modules/http/chunk_filter.c =================================================================== --- modules/http/chunk_filter.c (revision 1523591) +++ modules/http/chunk_filter.c (working copy) @@ -72,15 +72,17 @@ apr_status_t ap_http_chunk_filter(ap_filter_t *f, eos = e; break; } - if (AP_BUCKET_IS_ERROR(e) - && (((ap_bucket_error *)(e->data))->status - == HTTP_BAD_GATEWAY)) { - /* - * We had a broken backend. Memorize this in the filter - * context. - */ - f->ctx = &bad_gateway_seen; - continue; + if (AP_BUCKET_IS_ERROR(e)) { + switch (((ap_bucket_error *)(e->data))->status) { + case HTTP_BAD_GATEWAY: + case HTTP_GATEWAY_TIME_OUT: + /* + * We had a broken backend. Memorize this in the filter + * context. + */ + f->ctx = &bad_gateway_seen; + continue; + } } if (APR_BUCKET_IS_FLUSH(e)) { flush = e;