mirah / dubious

A Web Framework Written in Mirah for running on AppEngine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS files expire in past

hakunin opened this issue · comments

using this approach with number in url, it is possible to cache into infinity
http://michal-duby.appspot.com/stylesheets/sh_style.css?1279397780

but instead, the file sends these headers:

Cache-Control:public, max-age=600
Content-Encoding:gzip
Content-Length:832
Content-Type:text/css
Date:Sat, 31 Jul 2010 09:06:39 GMT
ETag:"yhD_1A"
Expires:Fri, 30 Jul 2010 21:11:59 GMT <-- expires in past
Server:Google Frontend

Just add the desired expiration to app.yaml,
these settings will propagate to appengine-web.xml

# app.yaml
static_files:
 - include: /**/*.ico
   expiration: 365d
 - include: /**/*.gif
   expiration: 365d
 - include: /**/*.jpeg
   expiration: 365d
 - include: /**/*.jpg
   expiration: 365d
 - include: /**/*.png
   expiration: 365d
 - include: /**/*.js
   expiration: 365d
 - include: /**/*.css
   expiration: 365d

# WEB-INF/appengine-web.xml 
<static-files>
  <include path='/**/*.ico' expiration='365d'/>
  <include path='/**/*.gif' expiration='365d'/>
  <include path='/**/*.jpeg' expiration='365d'/>
  <include path='/**/*.jpg' expiration='365d'/>
  <include path='/**/*.png' expiration='365d'/>
  <include path='/**/*.js' expiration='365d'/>
  <include path='/**/*.css' expiration='365d'/>
</static-files>

Thanks for the advice.

I was trying to point out that havign expiration in past on production machine when you can set them as "never expire" seems like a bug to me.

This is much simpler than what folks need to do with Apache. We do need to be careful, we don't want other developers setting this, but then creating the links by hand.

Thats a good point.
Maybe we could copy those files that are linked properly with dubious into a directory that would get those 356d expirations? (when publishing)

I've added the changes, we should be fine. We just need to be careful to document this for new users.