Rails 3自动添加X-UA-Compatible标头?

Rup*_*ict 6 javascript ruby-on-rails

如果您使用的是IE8,Rails 3会自动添加标题吗?我看到X-UA-Compatible的元标记设置为"IE = 8.0000"并且它弄乱了我的一个观点.

我似乎无法找到其他任何可以做到的事情,所以我想在这里问大脑.

谢谢,Ruprict

hel*_*inz 7

如果我们看一下vanilla rails3 app中加载的所有中间件:

rake middleware
(in /private/tmp/bla)
use ActionDispatch::Static
use Rack::Lock
use ActiveSupport::Cache::Strategy::LocalCache
use Rack::Runtime
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::RemoteIp
use Rack::Sendfile
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::MethodOverride
use ActionDispatch::Head
use ActionDispatch::BestStandardsSupport
run Bla::Application.routes
Run Code Online (Sandbox Code Playgroud)

有ActionDispatch :: BestStandardsSupport哪个设置X-UA-Compatible标头,但不是IE = 8.000.你运行3.0.0吗?

  • 您可以将config.action_dispatch.best_standards_support设置为false以禁用中间件,并在控制器中手动设置X-UA-Compatible标头(如果您需要进行细粒度调整),或者编写自己的中间件并将其插入机架底部stack来设置应用程序范围 (3认同)