Skip to content
Browse files

Added ignore_headers configuration option

Defaults to ['Set-Cookie'] thereby stripping cookies from cacheable responses
  • Loading branch information...
1 parent 13a41c3 commit 566f5d5a938c161abbfb06457df29fc90c4cb668 @rmm5t rmm5t committed Feb 10, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/rack/cache/options.rb
View
9 lib/rack/cache/options.rb
@@ -78,6 +78,14 @@ def option_name(key)
# Default: 0
option_accessor :default_ttl
+ # Set of response headers that are removed before storing them in the
+ # cache. These headers are only removed for cacheable responses. For
+ # example, in most cases, it makes sense to prevent cookies from being
+ # stored in the cache.
+ #
+ # Default: ['Set-Cookie']
+ option_accessor :ignore_headers
+
# Set of request headers that trigger "private" cache-control behavior
# on responses that don't explicitly state whether the response is
# public or private via a Cache-Control directive. Applications that use
@@ -138,6 +146,7 @@ def initialize_options(options={})
'rack-cache.metastore' => 'heap:/',
'rack-cache.entitystore' => 'heap:/',
'rack-cache.default_ttl' => 0,
+ 'rack-cache.ignore_headers' => ['Set-Cookie'],
'rack-cache.private_headers' => ['Authorization', 'Cookie'],
'rack-cache.allow_reload' => false,
'rack-cache.allow_revalidate' => false,

0 comments on commit 566f5d5

Please sign in to comment.
Something went wrong with that request. Please try again.