views:

38

answers:

1

Hi,

Does Rails 3 automatically add a header if you are using IE8? I am seeing the meta tag for X-UA-Compatible set to "IE=8.0000" and it's messing up one of my views.

I can't seem to find anything else that would be doing it, so figured I'd ask the brains here.

Thanks, Ruprict

A: 

If we have a look at all middlewares loaded in a 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

there's ActionDispatch::BestStandardsSupport which source is setting the X-UA-Compatible header, not with IE=8.000 though. Do you run 3.0.0?

hellvinz
I do ("Rails 3.0.0")...if I change that file to put EmulateIE7 for the type=:builtin case, then my code runs fine. I am not sure where the 8.0000 is coming from, but changing that code does fix this case (not that I will leave that change in, just saying...) Is there a way to change this at the app/page level?
Ruprict
you can set config.action_dispatch.best_standards_support to false to disable the middleware, and set manually the X-UA-Compatible header in your controller if you want a fine grained tuning, or write your own middleware and insert it at the bottom of the rack stack to set it application wide
hellvinz
Thanks, hellvinz!
Ruprict