You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bjoern Voigt <bj...@arcor.de> on 2016/04/15 23:02:18 UTC
[users@httpd] Apache proxy keeps cache directory empty
Since some years I run a local Apache proxy cache for localhost and the
192.168.1.0/24 network. My proxy cache directory /var/cache/apache-proxy
is cleaned by a htcacheclean weekly cron job.
In the meantime Apache stopped writing files in my cache directory
/var/cache/apache-proxy. The proxy function still works.
I doubt, that an Apache update with configuration directive changes may
have caused the problem. But I don't know after which event Apache
stopped caching.
Here is my Apache proxy configuration. I verified, that the modules
mod_proxy and mod_cache_disk are loaded, e.g. by making temporary syntax
errors between the "IfModule" directives and "apachectl configtest".
- Distribution: openSUSE Tumbleweed
- Apache 2.4.20
- /etc/apache2/conf.d/proxy.conf:
<IfModule
mod_proxy.c>
ProxyRequests On
ProxyVia On
AllowCONNECT 443
<Proxy *>
Require ip 192.168.1.0/255.255.255.0 127.0.0.0/255.0.0.0 ::1
</Proxy>
</IfModule>
<IfModule mod_cache.c>
<IfModule mod_cache_disk.c>
CacheRoot /var/cache/apache-proxy
CacheEnable disk /
CacheDirLevels 2
CacheDirLength 2
</IfModule>
</IfModule>
How can I debug the problem?
(Btw. "strace" shows, that the cache configuration directory
/var/cache/apache-proxy is never touched by Apache.)
Greetings,
Björn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache proxy keeps cache directory empty (SOLVED)
Posted by Bjoern Voigt <bj...@arcor.de>.
Yann Ylavic wrote:
> This prevents caching of forward-proxy URLs since they do not start /
> (but rather http://).
> Can you try:
> CacheEnable disk http://
> ?
Thank you. I found this solution at the same time here:
https://bz.apache.org/bugzilla/show_bug.cgi?id=53787
Now I have:
CacheEnable disk http://
CacheEnable disk ftp://
Greetings,
Björn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache proxy keeps cache directory empty
Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, Apr 15, 2016 at 11:02 PM, Bjoern Voigt <bj...@arcor.de> wrote:
>
> Here is my Apache proxy configuration.
[]
>
> <IfModule mod_cache.c>
> <IfModule mod_cache_disk.c>
> CacheRoot /var/cache/apache-proxy
> CacheEnable disk /
This prevents caching of forward-proxy URLs since they do not start /
(but rather http://).
Can you try:
CacheEnable disk http://
?
Regards,
Yann.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache proxy keeps cache directory empty
Posted by Bjoern Voigt <bj...@arcor.de>.
Rainer Jung wrote:
> First personally I don't like the use of IfModule. That is a nice
> feature, if you want to be flexible in turning on or of functional
> blocks. But if you have a more rigid configuration and you need a
> feature, why enclose it in IfModule? If the module really isn't
> loaded, you like a clear startup error, that tells you about CacheRoot
> directive isn't known etc. and not instead just load without having
> the cache enabled. So I suggest removing the IfModule directives
> (assuming that the proxy and cache features are not just optional for
> you).
Thank you for you detailed tips. To be honest, I adopted the practice of
IfModule directives from the Linux distributions. You are right, that
IfModule is seldom useful for private configurations. I commented out
the IfModule directives, but as I already wrote, this doesn't change
anything.
> Can you see the two level directory structure for the cache underneath
> /var/cache/apache-proxy? Are ownerships and permissions OK?
>
> For further debugging you can:
>
> - Add
>
> %{cache-hit}e %{cache-revalidate}e %{cache-miss}e
> %{cache-invalidate}e %{no-cache}e
I created a custom LogFile /var/log/apache2/proxy.log
LogFormat "%h %l %u %t \"%r\" %>s %b %{cache-hit}e %{cache-revalidate}e
%{cache-miss}e %{cache-invalidate}e %{no-cache}e" proxylog
CustomLog /var/log/apache2/proxy.log proxylog
The logged information is not very interesting. All the "cache*" entries
are "-":
Here is an example for www.apache.org and www.ubuntu.com from
/var/log/apache2/proxy.log. I pointed my browser the second time within
a minute to these addresses:
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/ HTTP/1.1" 200 12215 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/css/min.bootstrap.css HTTP/1.1" 200 12469 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/css/styles.css HTTP/1.1" 200 683 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/favicons/favicon-32x32.png HTTP/1.1" 200 2932 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/js/bootstrap.js HTTP/1.1" 200 11183 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/favicons/favicon.ico HTTP/1.1" 200 15086 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/js/jquery-2.1.1.min.js HTTP/1.1" 200 29505 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:22 +0200] "GET http://www.apache.org/favicons/favicon-194x194.png HTTP/1.1" 200 31800 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:23 +0200] "GET http://www.apache.org/favicons/favicon-96x96.png HTTP/1.1" 200 10679 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:24 +0200] "GET http://www.apache.org/favicons/favicon-16x16.png HTTP/1.1" 200 1922 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:24 +0200] "GET http://www.apache.org/favicons/android-chrome-192x192.png HTTP/1.1" 200 34004 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:25 +0200] "GET http://www.apache.org/img/karaf.jpg HTTP/1.1" 200 3538 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:25 +0200] "GET http://www.apache.org/img/ant.jpg HTTP/1.1" 200 6437 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:25 +0200] "GET http://www.apache.org/img/asf_logo.png HTTP/1.1" 200 21243 - - - - -
[...]
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "GET http://www.ubuntu.com/ HTTP/1.1" 200 9157 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "GET http://www.ubuntu.com/static/css/core-print.css?v=d6c3005 HTTP/1.1" 200 291 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "GET http://www.ubuntu.com/static/js/core.js?v=fa96109 HTTP/1.1" 200 2187 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "GET http://www.ubuntu.com/static/js/scratch.js?v=57ed62f HTTP/1.1" 200 5392 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "GET http://www.ubuntu.com/static/css/styles.css?v=bd0338e HTTP/1.1" 200 44455 - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:41 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:40 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:41 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:41 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:41 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
127.0.0.1 - - [19/Apr/2016:20:37:41 +0200] "CONNECT assets.ubuntu.com:443 HTTP/1.1" 200 - - - - - -
> - Add "CacheDetailHeader on" to the config and look at the response
> header "X-Cache-Detail" which tells you about the caching decision and
> reasons.
>
> - Increase the log level of mod_cache and mod_cache_disk via
>
> LogLevel warn cache:trace8 cache_disk:trace8
>
> Depending on your request load and cache activity this might result in
> lots of error log output.
Unfortunately after adding these directives (and restarting/reloading
Apache of course), there is still nothing about mod_cache_disk activity
in error log. What does this mean?
> - Have a look for mod_cache and mod_cache_disk entries for the time
> between your newest working version and the broken one in CHANGES:
>
> http://www.apache.org/dist/httpd/CHANGES_2.4
Ok, additionally I can try to do something like a Git bisect. But before
I'd like to see, that mod_cache_disk is working at all. Since there are
no entries from this module in error log, I am skeptical about this.
Greetings,
Björn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Apache proxy keeps cache directory empty
Posted by Rainer Jung <ra...@kippdata.de>.
Am 15.04.2016 um 23:02 schrieb Bjoern Voigt:
> Since some years I run a local Apache proxy cache for localhost and the
> 192.168.1.0/24 network. My proxy cache directory /var/cache/apache-proxy
> is cleaned by a htcacheclean weekly cron job.
>
> In the meantime Apache stopped writing files in my cache directory
> /var/cache/apache-proxy. The proxy function still works.
>
> I doubt, that an Apache update with configuration directive changes may
> have caused the problem. But I don't know after which event Apache
> stopped caching.
>
> Here is my Apache proxy configuration. I verified, that the modules
> mod_proxy and mod_cache_disk are loaded, e.g. by making temporary syntax
> errors between the "IfModule" directives and "apachectl configtest".
> - Distribution: openSUSE Tumbleweed
> - Apache 2.4.20
> - /etc/apache2/conf.d/proxy.conf:
> <IfModule
> mod_proxy.c>
>
> ProxyRequests On
> ProxyVia On
> AllowCONNECT 443
>
> <Proxy *>
> Require ip 192.168.1.0/255.255.255.0 127.0.0.0/255.0.0.0 ::1
> </Proxy>
> </IfModule>
>
> <IfModule mod_cache.c>
> <IfModule mod_cache_disk.c>
> CacheRoot /var/cache/apache-proxy
> CacheEnable disk /
> CacheDirLevels 2
> CacheDirLength 2
> </IfModule>
> </IfModule>
>
> How can I debug the problem?
> (Btw. "strace" shows, that the cache configuration directory
> /var/cache/apache-proxy is never touched by Apache.)
First personally I don't like the use of IfModule. That is a nice
feature, if you want to be flexible in turning on or of functional
blocks. But if you have a more rigid configuration and you need a
feature, why enclose it in IfModule? If the module really isn't loaded,
you like a clear startup error, that tells you about CacheRoot directive
isn't known etc. and not instead just load without having the cache
enabled. So I suggest removing the IfModule directives (assuming that
the proxy and cache features are not just optional for you).
Can you see the two level directory structure for the cache underneath
/var/cache/apache-proxy? Are ownerships and permissions OK?
For further debugging you can:
- Add
%{cache-hit}e %{cache-revalidate}e %{cache-miss}e %{cache-invalidate}e
%{no-cache}e
to the LogFormat that you are using in your CustomLog definition
(access log)
- Add "CacheDetailHeader on" to the config and look at the response
header "X-Cache-Detail" which tells you about the caching decision and
reasons.
- Increase the log level of mod_cache and mod_cache_disk via
LogLevel warn cache:trace8 cache_disk:trace8
Depending on your request load and cache activity this might result in
lots of error log output.
- Have a look for mod_cache and mod_cache_disk entries for the time
between your newest working version and the broken one in CHANGES:
http://www.apache.org/dist/httpd/CHANGES_2.4
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org