Since static files are only updated when you push new releases, you
can add a version number into the url for the static resource.

E.g. (python/django), in app.yaml:

  - url: /__v[^\/]+/static
    static_dir: yourapp/static
    expiration: 365d

Then in your template, create a templatetag (or something) that
injects the current build number into the url:

  <img src='{% vurl "/static/images/myimage.jpg" %}'/>

The rendered output would look something like:

  <img src='/__v12345/static/images/myimage.jpg'/>

where 12345 is your build number.

Doing this will allow you to set very long timeouts, but still have
fresh content (e.g., on a new code push).

j

On Nov 23, 3:35 pm, J <[email protected]> wrote:
> Adding them is easy, as Robert indicated.
>
> But be careful, not everything in the infrastructure respects them.
> Perhaps I should have said, respects them too much. If you have a
> static file header that is supposed to expire next Sunday, and update
> the file before that time, the infrastructure is not required to serve
> the latest version of the file since the expiry header has not expired
> yet.
>
> To get around this, you should implement some kind of a cache buster
> (Google the term) unless the static files are truly static.
>
> On Nov 23, 3:14 pm, Robert Kluin <[email protected]> wrote:
>
>
>
> > Yes.
>
> > Python:
> >  http://code.google.com/appengine/docs/python/config/appconfig.html#St...
>
> > Java:
> >  http://code.google.com/appengine/docs/java/config/appconfig.html#expi...
>
> > Robert
>
> > On Tue, Nov 23, 2010 at 11:11, vamsi <[email protected]> wrote:
> > > Hi all ,
> > > Is it possible to add Expiry headers to static files ?
>
> > > Regards
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Google App Engine" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to 
> > > [email protected].
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to