diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index c106aedba1..abee1e3663 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -604,9 +604,12 @@ static apr_status_t cache_out_filter(ap_filter_t *f, apr_bucket_brigade *in) apr_bucket_brigade *bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); - /* restore content type of cached response */ - ap_set_content_type(r, apr_table_get(cache->handle->resp_hdrs, - "Content-Type")); + /* restore content type of cached response if available */ + /* Needed especially when stale content gets served. */ + const char *ct = apr_table_get(cache->handle->resp_hdrs, "Content-Type"); + if (ct) { + ap_set_content_type(r, ct); + } /* restore status of cached response */ r->status = cache->handle->cache_obj->info.status;