`defined?(ActionDispatch::Static)` never returns false, even if serve_static_assets is false. This should probably check for its presence in `app.middleware` instead.