Clean dirty cookies from Rack environment and prevent Rack applications to stop working because of dirty cookies not conforming to RFC specifications.
This gem is useful only for Rack version <= 1.4.1; newer versions of Rack work correctly with bad encoded cookies.
Just edit your Gemfile and add:
then add Rack::CleanCookies::Middleware to your Rack stack, e.g.:
if you prefer to have the rack-errors env variable filled with dirty cookies, use:
use Rack::CleanCookies::Middleware, verbose: true
The original version was provided as a gist by Eric Cohen (https://github.com/eirc). Thanks!