markbates/rack-cachely — pull request #1 by timraymond (2013-05-31 20:02:53+00:00)
Title: Add whitelist mode to query parameters

This allows query parameters to be optionally whitelisted instead of
blacklisting individual ones. The implementation is intended to be
backwards compatible. When adding the Rack::Cachely middleware, simply
use allow_query_params instead of ignore_query_params like so:

Rails.application.config.middleware.use Rack::Cachely,
allow_query_params: ["foo", "bar"]

Note: If ignore_query_params and allow_query_params are both set, it is
assumed that this is a mistake, and the blacklisting behavior will be
invoked.

There is no way to blacklist all query params (or conversely whitelist
none). A workaround is to only whitelist a query param that you know you
will never receive.