Ok, after a bit search, I've got it working:
{{{
self.response.headers.add_header("Expires", "Thu, 01 Dec 2014 16")
self.response.headers["Cache-Control"] = "public, max-age=3660000"
self.response.headers['Content-Type'] = 'image/jpg'
self.response.out.write(photo.blob)
}}}
By default, the 'Cache-Control' is 'no-cache', so instead of
`add_header`, we'll need to overwrite it.
=================
With this problem solved, anyone knows how to assign a bit longer
expires time to the files in static folder?
Alex
On Jul 8, 1:20 pm, Alex Dong <
alex.d...@gmail.com> wrote:
> Hi everyone:
>
> Any idea on how can I add Cache-Control http header to the dynamically
> generated images?
>
> For the static files, Google offers a default one:
>
> curl -Ihttp://
wuic.appspot.com/static/styles.css
> {{{
> HTTP/1.1 200 OK
> Date: Tue, 08 Jul 2008 05:17:27 GMT
> Expires: Tue, 08 Jul 2008 05:27:27 GMT
> Cache-Control: public, max-age=600
> Content-Type: text/css
> Server: Google Frontend
> Content-Length: 7802
>
> }}}
>
> But for the dynamic image file, here is what I get:
> {{{
> curl -Ihttp://
wuic.appspot.com/photo/6930.jpg