[Catalyst] Make Catalyst NOT reset a cookie on a per action basis

Steve Kleiman steve at prodhub.com
Sun Aug 16 18:59:09 GMT 2009


OBJECTIVE:
On a per action basis, have Catalyst NOT reset cookies it finds using  
'Session::State::Cookie'.

PROBLEM:
Images are dispatched from a database (and therefore not statically  
served). The rest of the app requires a cookie to be set, but for  
images coming from a specific action, a cookie should NOT be set  
because the browser will not cache an image with a cookie (it is  
immediately stale). The result is no caching and a hit to the database  
every time an image is requested.

WHAT I CAN SEE:
Catalyst engine calls "finalize_cookies" which resets every cookie it  
finds. This takes place before the 'begin' method and the 'Set-Cookie'  
header has already been dispatched. Therefore removing that header in  
'begin' does nothing. If the original request did not present a  
cookie, then Catalyst does not regurgitate the cookie and everything  
works great.

Thanks for any guidance. It'd be great of there's a solution that  
doesn't require constraining the cookie path.

Appreciatively,

Steve Kleiman
Los Angeles, California
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090816/1f902208/attachment.htm


More information about the Catalyst mailing list