No commit activity in last 3 years
No release in over 3 years
Rack middleware to disable cookies when static content is being served, which can prevent caching on some HTTP accelerators (Varnish).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0
 Project Readme

Sinatra::CookieThief

Rack middleware for Sinatra that disables cookies when content being served is a static asset. Some HTTP accelerators (particularly Varnish) will not cache when Set-Cookie is present. This prevents files from not being cached. It is kind of a hack.

Installation and Usage

gem install sinatra-cookie_thief

For classic-style:

require 'sinatra'
require 'sinatra/cookie_thief'
register Sinatra::CookieThief
enable :sessions

For classy-style:

require 'sinatra/base'
class App < Sinatra::Base
  register Sinatra::CookieThief
  enable :sessions
end

Improvements

Send a pull request! Note that there are tests to demonstrate the current behavior.