Replace all '?'s in URLs with '%1F' (the ASCII unit separator char), and a middleware to undo it before your rack app sees.
Tom Lea
gem "cachable_url", "~> 0.0.1"