```ruby
require 'dragonfly'
require 'rails'

module Dragonfly
  class Railtie < ::Rails::Railtie
    initializer "dragonfly.railtie.initializer" do |app|
      app.middleware.insert 1, Dragonfly::CookieMonster
    end
  end
end
```

Put CookieMonster before ActionDispatch::Cookies - that way Rack::Cache won't come between them and mess things up
user
```ruby
require 'dragonfly'
require 'rails'

module Dragonfly
  class Railtie < ::Rails::Railtie
    initializer "dragonfly.railtie.initializer" do |app|
      app.middleware.insert_before 'ActionDispatch::Cookies', Dragonfly::CookieMonster
    end
  end
end
```
assistant