Is there a way to disable certain middleware based on the route? Part of my application is an API that shouldn’t really ever be sending 304’s while I’m fine with the web application doing that. It seems like removing Rack::ConditionalGet should eliminate the setting of the 304 when the ETags match, but I don’t see a way in the documentation to remove middleware non-globally.
I don’t think so, at least not without splitting out your api into an engine which would then (IIRC - engines aren’t something I’ve really used) have its own middleware stack.
It should however be relatively easy to write your own middleware which, depending on the path, either calls through to the next item in the stack or invokes the Rack::Etag stuff and then replace the Rack::Etag middleware with that