views:

41

answers:

1

Hi, in my Pylons app i write a script to autogenerate thumbnail, from image geting by url.

To generate thumbnail i use PIL(python)

W wont to prevent image cache by browser.

I can't use after src ?[random_number] because the site, where i past this image must be static.

I try to send headers

response.headers['Cache-Control'] = 'no-store,no-cache, must-revalidate,post-check=0, pre-check=0,max-age=0'

But still don't work, the browser cache this image,

Can anyone help me to resolved this problem?

Thanks in advance.

A: 

Traditionally, you need additional headers to catch most browsers, and even then some will still cache it. Even browsers that support the Cache-Control header (which is part of HTTP 1.1) may be connecting through an HTTP 1.0 proxy that strips out nonstandard headers. I'd try also adding an explicit Expires header with the date and time the image is sent (or just a fixed date in the past) and also a Pragma header with the value "no-cache."

response.headers['Cache-Control'] = 'no-store,no-cache, must-revalidate,post-check=0, pre-check=0,max-age=0'
response.headers['Expires'] = 'Wed, 01 Sep 2010 00:00:00 GMT'
response.headers['Pragma'] = 'no-cache'
kindall