[mod_python] How can I turn off apparent caching of python code?

Byron Ellacott bje at apnic.net
Thu Aug 26 12:00:01 EDT 2004


Jorey Bump wrote:
>  req.headers_out['Pragma'] = 'no-cache'
>  req.headers_out['Cache-Control'] = 'no-cache'
>  req.headers_out['Expires'] = '-1'

There's one caveat to always setting these: Internet Explorer will not 
be able to view any external program data inline over HTTPs with them 
set.  For example, if you generate a PDF or an XLS or similar, and serve 
them with the above headers over an HTTPS connection, if IE is 
instructed to open the file immediately (either via the dialog box that 
opens, or by that dialog's "Always do the same thing" setting) it will 
fail dismally.

To be hopefully clearer: An Internet Explorer quirk/feature/bug will 
prevent the user from viewing files opened with another application when 
sent over HTTPS with caching disabled.

If that's not a situation which applies to you, nevermind. :)

(There's a whole realm of problems with https in apache2; this 
particular one caused a few problems as well, though it's IE specific, 
not apache2 specific.)

-- 
bje


More information about the Mod_python mailing list