hi
I'm trying to cache dynamically generated content using an Apache 2.2
reverse proxy.
Apache proxies content coming from Tomcat through AJP protocol.
For some reason mod_cache determines that cacheable content is not fresh
and refetches the content
though the application sets the Expires and Cache-Control HTTP response
headers (see below).
I'd like to be able to always cache cacheable pages for a certain period
of time without any further freshness validation
and force non-cacheable pages to be excluded from caching.
How should I set the response headers and configure mod_cache in order
to do that?
Marko
Here's a debug log extract from a page load:
[Thu Dec 06 22:25:35 2007] [debug] mod_disk_cache.c(477): disk_cache:
Recalled cached URL info header
http://localhost:5050/cachetest/jsp/cacheable/main.jsp?
[Thu Dec 06 22:25:35 2007] [debug] mod_disk_cache.c(750): disk_cache:
Recalled headers for URL
http://localhost:5050/cachetest/jsp/cacheable/main.jsp?
[Thu Dec 06 22:25:35 2007] [debug] cache_storage.c(272): Cached response
for /cachetest/jsp/cacheable/main.jsp isn't fresh. Adding/replacing
conditional request headers.
[Thu Dec 06 22:25:35 2007] [debug] mod_cache.c(129): Adding CACHE_SAVE
filter for /cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] mod_cache.c(136): Adding
CACHE_REMOVE_URL filter for /cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_ajp.c(44): proxy: AJP:
canonicalising URL //127.0.0.1:8009/cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] proxy_util.c(1378): [client
127.0.0.1] proxy: ajp: found worker ajp://127.0.0.1:8009/cachetest for
ajp://127.0.0.1:8009/cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy.c(777): Running scheme ajp
handler (attempt 0)
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_http.c(1652): proxy: HTTP:
declining URL ajp://127.0.0.1:8009/cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_ajp.c(507): proxy: AJP:
serving URL ajp://127.0.0.1:8009/cachetest/jsp/cacheable/main.jsp
[Thu Dec 06 22:25:35 2007] [debug] proxy_util.c(1798): proxy: AJP: has
acquired connection for (127.0.0.1)
[Thu Dec 06 22:25:35 2007] [debug] proxy_util.c(1859): proxy: connecting
ajp://127.0.0.1:8009/cachetest/jsp/cacheable/main.jsp to 127.0.0.1:8009
[Thu Dec 06 22:25:35 2007] [debug] proxy_util.c(1955): proxy: connected
/cachetest/jsp/cacheable/main.jsp to 127.0.0.1:8009
[Thu Dec 06 22:25:35 2007] [debug] proxy_util.c(2050): proxy: AJP: fam 2
socket created to connect to 127.0.0.1
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(218): Into
ajp_marshal_into_msgb
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[0] [Host] = [localhost:5050]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[1] [User-Agent] = [Mozilla/5.0 (X11; U;
Linux i686; en-US; rv:1.9b1) Gecko/2007110903 Firefox/3.0b1]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[2] [Accept] =
[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[3] [Accept-Language] = [en-us,en;q=0.5]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[4] [Accept-Encoding] = [gzip,deflate]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[5] [Accept-Charset] =
[ISO-8859-1,utf-8;q=0.7,*;q=0.7]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[6] [Keep-Alive] = [300]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[7] [Connection] = [keep-alive]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[8] [Cookie] =
[JSESSIONID=4ACF4EDC4DCBC6253DE8F810598F0771; SCREEN_NAME=iscdwJTOWtk=;
[EMAIL PROTECTED]; COOKIE_SUPPORT=true; GUEST_LANGUAGE_ID=fi_FI]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[9] [Cache-Control] = [max-age=0]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(284):
ajp_marshal_into_msgb: Header[10] [Max-Forwards] = [10]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(424):
ajp_marshal_into_msgb: Done
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_ajp.c(188): proxy:
APR_BUCKET_IS_EOS
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_ajp.c(193): proxy: data to
read (max 8186 at 4)
[Thu Dec 06 22:25:35 2007] [debug] mod_proxy_ajp.c(208): proxy: got 0
bytes of data
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(643): ajp_read_header:
ajp_ilink_received 04
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(653): ajp_parse_type: got 04
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(484):
ajp_unmarshal_response: status = 200
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(495):
ajp_unmarshal_response: Number of headers is = 4
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(557):
ajp_unmarshal_response: Header[0] [Expires] = [Fri, 7 Dec 2007 14:19:41 GMT]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(557):
ajp_unmarshal_response: Header[1] [Cache-Control] = [max-age=3600]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(557):
ajp_unmarshal_response: Header[2] [Content-Type] = [text/html;charset=UTF-8]
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(567):
ajp_unmarshal_response: ap_set_content_type done
[Thu Dec 06 22:25:35 2007] [debug] ajp_header.c(557):
ajp_unmarshal_response: Header[3] [Content-Length] = [341]
...
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]