mod_cache supports 304 Not Modified conditionals?

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 1
Joined: 05 Feb 2016, 23:52

mod_cache supports 304 Not Modified conditionals?

06 Feb 2016, 11:59

I installed the latest version of Ape yesterday (3.1.0.248) on an Win2008R2 IIS 7.5 server. I'm trying to setup mod_cache to handle image/jpeg files and running into some problems handling conditional requests based on Etags or If-Modified-Since requests. The problem is that mod_cache doesn't respond with a 304, it just sends the cached content over the wire with an HTTP 200.

I have an image-serving classic ASP script that's been in use for about 8 years. During that period it's been hosted in a web garden worker process running in Classic Pipeline mode. The script implements some business logic related to user-generated uploads and how/if we display the files publicly. The script sets its own cache-control headers and Etags. It also properly responds to conditional requests based on if-none-match or if-modified-since.

So I've setup a new test site to try to port this over to using Ape for URL rewriting and caching. I am not using mod_expires. The test site has Ape running fine in a single worker process Integrated Pipeline. I can see mod_cache serving responses because there's an Age: header in the HTTP response. But what I would really like is to have mod_cache respond with a 304 Not Modified if there's a matching Etag or if-Modified-since condition. No need to send the image content over the wire if it's already cached on the client.

Is it possible to setup mod_cache to respond with a 304?

Here's my htaccess on the test site.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*/site/.*
RewriteRule ^(.*) /site/image.asp?f=$1 [NC, L]

<files image.asp>
CacheEnable mem
CacheVaryByParams f
</files>


I have also tried CacheVaryByHeaders Etag.

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: mod_cache supports 304 Not Modified conditionals?

07 Feb 2016, 09:22

Hello.

Already answered your e-mail but here you provided more information. Please try to switch to disk cache from memory cache.
You will need mod_expires anyway as many clients will not send If-Modified-Since without proper Expires and Cache-Control headers.

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 0 guests