Bug 46241 - mod_expires - ExpiresByPattern or ExpiresIf
Summary: mod_expires - ExpiresByPattern or ExpiresIf
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_expires (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-19 03:38 UTC by Jeff Armstrong
Modified: 2008-11-19 10:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Armstrong 2008-11-19 03:38:56 UTC
Hello, 

an enhancement request for mod_expires would be much apprciated;

Suggestion 1: ExpiresByPattern 

ExpiresByPattern \.(png|gif|jpg) A2592000
ExpiresByPattern ticker\.gif     A-1

Where the last match wins/overwrites, so I can put general expires in main config and then allow virtuals to specialise more specific patterns as they wish

The ExpiresByType is just too big a brush for complex things.

Suggestion 2: ExpiresIf 
Alternately, you might consider something like:

SetEnvIf Request_URI "\.jpg$"       expiry=month
SetEnvIf Request_URI "\.gif$"       expiry=year
SetEnvIf Request_URI "ticker\.gif$" !expiry

ExpiresIf %{ENV:expiry}=month A2592000
ExpiresIf %{ENV:expiry}=year "access plus 1 year"

etc.

Many thanks!
Jeff
Comment 1 Ruediger Pluem 2008-11-19 09:42:21 UTC
IMHO you should be able to do this for local files already:

 <FilesMatch "\.(png|gif|jpg)">
ExpiresDefault  A2592000
</FilesMatch>
Comment 2 Jeff Armstrong 2008-11-19 10:19:16 UTC
You are correct - and the LAST <FilesMatch> directive wins

  <FilesMatch "\.(png|gif|jpg)$">
    ExpiresDefault  "access plus 2 months"
  </FilesMatch>

  <FilesMatch "ticker\.gif$">
    ExpiresDefault  A0
  </FilesMatch>

works as expected.

Many thanks, perhaps this enhancement request should be downgraded to 'update the docs with an example'.