Skip to content

Commit

Permalink
Remove BestStandardsSupport middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran committed Jan 29, 2013
1 parent 88e4ec6 commit 3bccd12
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 108 deletions.
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch.rb
Expand Up @@ -47,7 +47,6 @@ class IllegalStateError < StandardError

autoload_under 'middleware' do
autoload :RequestId
autoload :BestStandardsSupport
autoload :Callbacks
autoload :Cookies
autoload :DebugExceptions
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/railtie.rb
Expand Up @@ -6,7 +6,6 @@ class Railtie < Rails::Railtie # :nodoc:
config.action_dispatch.x_sendfile_header = nil
config.action_dispatch.ip_spoofing_check = true
config.action_dispatch.show_exceptions = true
config.action_dispatch.best_standards_support = true
config.action_dispatch.tld_length = 1
config.action_dispatch.ignore_accept_header = false
config.action_dispatch.rescue_templates = { }
Expand Down
35 changes: 0 additions & 35 deletions actionpack/test/dispatch/best_standards_support_test.rb

This file was deleted.

4 changes: 0 additions & 4 deletions railties/lib/rails/application.rb
Expand Up @@ -365,10 +365,6 @@ def default_middleware_stack #:nodoc:
middleware.use ::Rack::Head
middleware.use ::Rack::ConditionalGet
middleware.use ::Rack::ETag, "no-cache"

if config.action_dispatch.best_standards_support
middleware.use ::ActionDispatch::BestStandardsSupport, config.action_dispatch.best_standards_support
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/configuration.rb
Expand Up @@ -27,11 +27,11 @@ module Configuration
#
# Middlewares can also be completely swapped out and replaced with others:
#
# config.middleware.swap ActionDispatch::BestStandardsSupport, Magical::Unicorns
# config.middleware.swap ActionDispatch::Flash, Magical::Unicorns
#
# And finally they can also be removed from the stack completely:
#
# config.middleware.delete ActionDispatch::BestStandardsSupport
# config.middleware.delete ActionDispatch::Flash
#
class MiddlewareStackProxy
def initialize
Expand Down
Expand Up @@ -19,9 +19,6 @@
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Only use best-standards-support built into browsers.
config.action_dispatch.best_standards_support = :builtin

<%- unless options.skip_active_record? -%>
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL).
Expand Down
30 changes: 0 additions & 30 deletions railties/test/application/middleware/best_practices_test.rb

This file was deleted.

3 changes: 1 addition & 2 deletions railties/test/application/middleware_test.rb
Expand Up @@ -45,8 +45,7 @@ def app
"ActionDispatch::ParamsParser",
"Rack::Head",
"Rack::ConditionalGet",
"Rack::ETag",
"ActionDispatch::BestStandardsSupport"
"Rack::ETag"
], middleware
end

Expand Down

7 comments on commit 3bccd12

@rubys
Copy link
Contributor

@rubys rubys commented on 3bccd12 Jun 13, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jfirebaugh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 Without this, the UI for switching to a non-standards compatibility mode is still provided, and I have encountered users who got into a bad mode accidentally, breaking the site, and didn't know how to fix it.

@rafaelfranca
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set this header manually.

config.action_dispatch.default_headers = {
  "X-UA-Compatible" => "IE=Edge,chrome=1"
}

@guilleiguaran
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfirebaugh this wasn't completely removed, was just moved to the set of default headers (config.action_dispatch.default_headers) since we don't want to have a middleware just to add a header.

@jfirebaugh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer. The default default_headers results in X-UA-Compatible: chrome=1. I would say it should be X-UA-Compatible: IE=Edge,chrome=1, to match Rails 3 behavior and eliminate the possibility of the user accidentally switching to a non-standards compatibility mode.

@rafaelfranca
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfirebaugh unfortunately we can't change it again now or it will break people application that expect only chrome=1

@timkurvers
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting that because of the removal of IE=Edge certain users may now be served pages in compatibility mode because of their intranet settings. In our case it renders pages in IE7 compatibility mode. The only way to work-around these intranet enforcements is by explicitly adding IE=Edge back.

Please sign in to comment.