Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to get mod_cache_disk to cache a site containing query strings. The issue is that it's a vendor product on IIS that we're trying to cache through mod_proxy and it does not contain expires headers. I realize this issue violates several RFCs and that's why apache does not do it by default.

Is there a way to force apache 2.4.x to cache with query string and no expires header?

This configuration will cache, but of course without honoring ? it caches the wrong content for most items.

CacheEnable disk https://
CacheEnable disk /
CacheRoot /var/cache/mod_proxy/
CacheDirLevels 4
CacheDirLength 5
CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreHeaders None
CacheMaxFileSize 100000000
CacheMinFileSize 1
CacheMaxExpire 1209600
CacheDefaultExpire 3600
CacheIgnoreQueryString On
CacheStoreNoStore On
CacheStorePrivate On

If I change CacheIgnoreQueryString to Off it will start emitting errors about the expires header.

AH00768: cache: /view.image?Id=1114 not cached. Reason: Query string present but no explicit expiration time,

share|improve this question

1 Answer 1

up vote 0 down vote accepted

According to this answer the only way to do this is to let Apache see the headers it wants (Expires, which you stated, and, apparently also Last-Modified).

The poster of that answer suggested writing a filter on the application side, but since yours is a vendor product, that may not be possible. Is there a chance to add it directly in IIS? Otherwise, you might have luck with a double proxy setup: use one proxy to add the headers (but not cache), and proxy that from Apache (taking the headers and caching).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.