Mailing List Archive

Apache 2.4 : issue caching mod_cache
Hi All,
we tried to configure mod_cache on a Apache HTTPD 2.4 instance but we
noticed that a elements hasn't been served from the cache because we have
cache miss message like:

127.0.0.1164 [07/Jul/2022:11:17:54 +0200] 27320 "GET /files/json/test.json
HTTP/1.1" 200 13479 cache miss: attempting entity save

If we checked with the htcacheclean command we found a lot of keys in cache
of this URI:

51760 https://localhost:443/files/json/test.json?

Could you help us to identify the issue of this missing caching?

Thanks,
Marcello
Re: Apache 2.4 : issue caching mod_cache [ In reply to ]
On Thu, Jul 7, 2022 at 5:27 AM Marcello Lorenzi <cello86@gmail.com> wrote:
>
> Hi All,
> we tried to configure mod_cache on a Apache HTTPD 2.4 instance but we noticed that a elements hasn't been served from the cache because we have cache miss message like:
>
> 127.0.0.1164 [07/Jul/2022:11:17:54 +0200] 27320 "GET /files/json/test.json HTTP/1.1" 200 13479 cache miss: attempting entity save
>
> If we checked with the htcacheclean command we found a lot of keys in cache of this URI:

Can you show the response headers?
>
> 51760 https://localhost:443/files/json/test.json?
>
> Could you help us to identify the issue of this missing caching?
>
> Thanks,
> Marcello



--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache 2.4 : issue caching mod_cache [ In reply to ]
Hi Eric,
thanks for the response. The responses headers are:

HTTP/1.1 200 OK
Date: Thu, 07 Jul 2022 11:39:41 GMT
Server: Apache
Strict-Transport-Security: max-age=16070400; includeSubDomains; preload
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Vary: Cookie,Accept-Encoding
Last-Modified: Thu, 07 Jul 2016 13:35:02 GMT
Accept-Ranges: bytes
Content-Length: 13085
X-Powered-By: ASP.NET
X-UA-Compatible: IE=edge,chrome=1
Content-Security-Policy: frame-ancestors 'self'
Cache-Control: max-age=300
Content-Security-Policy-Report-Only: xxx

Regards,
Marcello

On Thu, Jul 7, 2022 at 1:15 PM Eric Covener <covener@gmail.com> wrote:

> On Thu, Jul 7, 2022 at 5:27 AM Marcello Lorenzi <cello86@gmail.com> wrote:
> >
> > Hi All,
> > we tried to configure mod_cache on a Apache HTTPD 2.4 instance but we
> noticed that a elements hasn't been served from the cache because we have
> cache miss message like:
> >
> > 127.0.0.1164 [07/Jul/2022:11:17:54 +0200] 27320 "GET
> /files/json/test.json HTTP/1.1" 200 13479 cache miss: attempting entity save
> >
> > If we checked with the htcacheclean command we found a lot of keys in
> cache of this URI:
>
> Can you show the response headers?
> >
> > 51760 https://localhost:443/files/json/test.json?
> >
> > Could you help us to identify the issue of this missing caching?
> >
> > Thanks,
> > Marcello
>
>
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Re: Apache 2.4 : issue caching mod_cache [ In reply to ]
On Thu, Jul 7, 2022 at 7:41 AM Marcello Lorenzi <cello86@gmail.com> wrote:
>
> Hi Eric,
> thanks for the response. The responses headers are:
>
> HTTP/1.1 200 OK
> Date: Thu, 07 Jul 2022 11:39:41 GMT
> Server: Apache
> Strict-Transport-Security: max-age=16070400; includeSubDomains; preload
> X-Xss-Protection: 1; mode=block
> X-Content-Type-Options: nosniff
> Vary: Cookie,Accept-Encoding

Vary: Cookie is the likely culprit. This means each unique Cookie:
request header gets a different result.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Apache 2.4 : issue caching mod_cache [ In reply to ]
Hi Eric,
I checked the configuration to verify if cookie or set-cookie headers are
excluded and this is the actual configuration:

<IfModule mod_cache.c>
CacheIgnoreCacheControl On
CacheIgnoreQueryString Off
CacheIgnoreURLSessionIdentifiers _
CacheIgnoreHeaders Set-Cookie Cookie
CacheDefaultExpire 60
CacheMaxExpire 300
<IfModule mod_cache_disk.c>
CacheRoot /var/cache/apache/
CacheMaxFileSize 5000000000
CacheEnable disk /files/
</IfModule>
</IfModule>

I also tried to add the unset of Vary header:

<Location /files/json/test.json>
Header unset Vary
</Location>

The responde headers were:

HTTP/1.1 200 OK
Date: Thu, 07 Jul 2022 12:30:34 GMT
Server: Apache
Strict-Transport-Security: max-age=16070400; includeSubDomains; preload
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Last-Modified: Thu, 07 Jul 2016 13:35:02 GMT
Accept-Ranges: bytes
Content-Length: 13085
X-Powered-By: ASP.NET
X-UA-Compatible: IE=edge,chrome=1
Content-Security-Policy: frame-ancestors 'self'
Cache-Control: max-age=300
Content-Security-Policy-Report-Only: xxx
Content-Type: application/json

but the logs reported:

127.0.0.1 [07/Jul/2022:14:30:34 +0200] 251 "GET
/files/json/testt.json?test=1 HTTP/1.1" 200 13085 cache miss: attempting
entity save

I also added the headers debug for mod_cache module:

HTTP/1.1 200 OK
Date: Thu, 07 Jul 2022 12:33:14 GMT
Server: Apache
Strict-Transport-Security: max-age=16070400; includeSubDomains; preload
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Last-Modified: Thu, 07 Jul 2016 13:35:02 GMT
Accept-Ranges: bytes
Content-Length: 13085
X-Powered-By: ASP.NET
X-UA-Compatible: IE=edge,chrome=1
Content-Security-Policy: frame-ancestors 'self'
Cache-Control: max-age=300
Content-Security-Policy-Report-Only: xxx
X-Cache: MISS from localhost
X-Cache-Detail: "cache miss: attempting entity save" from localhost
Content-Type: application/json

Regards,
Marcello

On Thu, Jul 7, 2022 at 1:58 PM Eric Covener <covener@gmail.com> wrote:

> On Thu, Jul 7, 2022 at 7:41 AM Marcello Lorenzi <cello86@gmail.com> wrote:
> >
> > Hi Eric,
> > thanks for the response. The responses headers are:
> >
> > HTTP/1.1 200 OK
> > Date: Thu, 07 Jul 2022 11:39:41 GMT
> > Server: Apache
> > Strict-Transport-Security: max-age=16070400; includeSubDomains; preload
> > X-Xss-Protection: 1; mode=block
> > X-Content-Type-Options: nosniff
> > Vary: Cookie,Accept-Encoding
>
> Vary: Cookie is the likely culprit. This means each unique Cookie:
> request header gets a different result.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>