Bug 64934 - Cache control header missing in HEAD request during cache miss
Summary: Cache control header missing in HEAD request during cache miss
Status: REOPENED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_headers (show other bugs)
Version: 2.4.46
Hardware: Other Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: Beginner
Depends on:
Blocks:
 
Reported: 2020-11-19 19:00 UTC by Rakesh
Modified: 2020-12-06 06:55 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rakesh 2020-11-19 19:00:29 UTC
Cache control header missing for HEAD request but works for GET.


curl -I https://localhost/support.html  -k
HTTP/1.1 200 OK
Date: Thu, 19 Nov 2020 16:35:48 GMT
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=utf-8
Content-Language: en

Using GET 

curl -i http://localhost/support.html
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
Last-Modified: Thu, 19 Nov 2020 18:57:55 GMT
Accept-Ranges: bytes
Content-Length: 206001
Expires: Fri, 20 Nov 2020 18:58:00 GMT
Vary: Accept-Encoding
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: public, max-age=86400
Content-Type: text/html
Content-Language: en

we do have a ADOBE aem dispatcher module in between , but this behavior was completely  different on Apache2.2 were header appears on both HEAD and GET
Comment 1 Rakesh 2020-11-24 00:02:17 UTC
changed  cache control rule.
from
Header set Cache-Control "public, max-age=86400"
to
Header always set Cache-Control "public, max-age=86400"
Comment 2 Rakesh 2020-12-04 16:50:55 UTC
(In reply to Rakesh from comment #1)
> changed  cache control rule.
> from
> Header set Cache-Control "public, max-age=86400"
> to
> Header always set Cache-Control "public, max-age=86400"



Can any one guide me how apache determines not to add header, since documentation suggest if there is error from backend apache will not add header if onsuccess is used , above fix will add cache control header  to even 404 and 302 . I am not able to find a reason why Apache is not adding header.
Comment 3 Rakesh 2020-12-04 23:46:31 UTC
To be more precise this behavior happens when content is not cached on Apache request is passed to the backend server and on the response header is missing . when the content is cached on apache header is inserted properly.