--- modules/http/http_filters.c (revision 1879400) +++ modules/http/http_filters.c (working copy) @@ -1427,25 +1427,21 @@ h.bb = b2; if (r->status == HTTP_NOT_MODIFIED) { - apr_table_do((int (*)(void *, const char *, const char *)) form_header_field, - (void *) &h, r->headers_out, - "Connection", - "Keep-Alive", - "ETag", - "Content-Location", - "Expires", - "Cache-Control", - "Vary", - "Warning", - "WWW-Authenticate", - "Proxy-Authenticate", - "Set-Cookie", - "Set-Cookie2", - NULL); + /* + * List of headers that must not be updated on a 304 (or 206 partial content) + * https://tools.ietf.org/id/draft-ietf-httpbis-cache-08.txt + */ + apr_table_unset(r->headers_out, "Content_Encoding"); + apr_table_unset(r->headers_out, "Content_Length"); + apr_table_unset(r->headers_out, "Content_MD5"); + apr_table_unset(r->headers_out, "Content_Range"); + apr_table_unset(r->headers_out, "ETag"); + apr_table_unset(r->headers_out, "TE"); + apr_table_unset(r->headers_out, "Trailer"); + apr_table_unset(r->headers_out, "Transfer_Encoding"); + apr_table_unset(r->headers_out, "Upgrade"); } - else { - send_all_header_fields(&h, r); - } + send_all_header_fields(&h, r); terminate_header(b2);