Requests handled by mod_dir are not cached. Examples below. 1) Cached request: $ curl -s http://localhost/index.html > /dev/null $ curl -I http://localhost/index.html HTTP/1.1 200 OK Date: Tue, 24 Jun 2008 23:19:41 GMT Server: Apache/2.2.9 (Unix) Last-Modified: Mon, 09 Jun 2008 13:16:13 GMT ETag: "481a3-10c0-44f3b9d9fc140" Accept-Ranges: bytes Content-Length: 4288 Cache-Control: max-age=120 Expires: Tue, 24 Jun 2008 23:21:28 GMT Age: 13 Content-Type: text/html 2) Uncached request (via mod_dir): $ curl -s http://localhost/ > /dev/null $ curl -I http://localhost/ HTTP/1.1 200 OK Date: Tue, 24 Jun 2008 23:22:39 GMT Server: Apache/2.2.9 (Unix) Last-Modified: Mon, 09 Jun 2008 13:16:13 GMT ETag: "481a3-10c0-44f3b9d9fc140" Accept-Ranges: bytes Content-Length: 4288 Cache-Control: max-age=120 Expires: Tue, 24 Jun 2008 23:24:39 GMT Content-Type: text/html Some snippets of the httpd.conf file: --------------------------------- <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all ExpiresActive On <Files ~ "^index.html$"> ExpiresDefault A120 </Files> </Directory> CacheRoot /var/cache/apache/ CacheEnable disk / CacheDirLevels 2 CacheDirLength 1 CacheIgnoreCacheControl On <IfModule dir_module> DirectoryIndex index.html </IfModule> ---------------------------------
*** Bug 45347 has been marked as a duplicate of this bug. ***
In mod_dir, used ap_internal_fast_redirect, so CACHE_SAVE filter is not executed. mod_dir use fast_redirect only when the file is local static file. if (rr->status == HTTP_OK && ( (rr->handler && !strcmp(rr->handler, "proxy-server")) || rr->finfo.filetype == APR_REG)) { ap_internal_fast_redirect(rr, r); return OK; }
As described on duplicate Bug 51057, this bug produces a significant loss of functionality for example: This URL is cached (because the DirectoryIndex of mod_dir is not being used): http://www.my-company.com/index.php This URL is _not_ cached because it is using the DirectoryIndex directive: http://www.my-company.com/ The "home page" of a web site is frequently visited. And it's not getting cached. This is a significant loss of functionality mod_disk_cache is desired to provide.
*** Bug 51057 has been marked as a duplicate of this bug. ***
This should be fixed in the latest 2.2.x release. Can you please test?
Yes, in production release of 2.2.17 I confirm it's fixed. I compiled from source for CentOS 5.6. ---== Details ==--- # cat /etc/*release* CentOS release 5.6 (Final) #uname -a OS: Linux 2.6.18-238.5.1.el5 #1 SMP Fri Apr 1 18:41:58 EDT 2011 x86_64 # /usr/local/apache2/bin/httpd -V Server version: Apache/2.2.17 (Unix) Server built: Apr 22 2011 21:56:30 Server's Module Magic Number: 20051115:25 Server loaded: APR 1.4.2, APR-Util 1.3.10 Compiled using: APR 1.4.2, APR-Util 1.3.10 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=2 -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" ---== Configure statement ==--- ./configure --prefix="/usr/local/apache2" CFLAGS="-DDYNAMIC_MODULE_LIMIT=2 -DDEFAULT_PIDLOG=\"run/httpd.pid\"" --disable-imagemap --disable-userdir --disable-asis --disable-actions --disable-authn-default --disable-authz-groupfile --disable-authz-default --disable-filter --disable-negotiation --disable-version --disable-cgi --enable-autoindex --enable-cache --enable-expires=shared --enable-disk-cache --enable-deflate --enable-headers --enable-info=shared --enable-rewrite --enable-ssl --enable-proxy --disable-proxy-balancer --disable-proxy-ftp --disable-proxy-scgi --disable-proxy-ajp --disable-proxy-balancer --enable-reqtimeout --enable-vhost-alias --enable-mime --with-mpm=prefork