2010-01-17 06:41:55 -05:00
|
|
|
require "action_dispatch"
|
|
|
|
|
|
|
|
module ActionDispatch
|
2012-12-01 13:10:08 -05:00
|
|
|
class Railtie < Rails::Railtie # :nodoc:
|
2010-03-26 13:47:55 -04:00
|
|
|
config.action_dispatch = ActiveSupport::OrderedOptions.new
|
2011-08-07 11:34:49 -04:00
|
|
|
config.action_dispatch.x_sendfile_header = nil
|
2010-03-03 19:22:30 -05:00
|
|
|
config.action_dispatch.ip_spoofing_check = true
|
2010-04-02 14:00:29 -04:00
|
|
|
config.action_dispatch.show_exceptions = true
|
2010-07-27 10:39:28 -04:00
|
|
|
config.action_dispatch.tld_length = 1
|
2011-05-02 17:38:39 -04:00
|
|
|
config.action_dispatch.ignore_accept_header = false
|
2011-12-01 13:16:19 -05:00
|
|
|
config.action_dispatch.rescue_templates = { }
|
|
|
|
config.action_dispatch.rescue_responses = { }
|
2012-01-17 05:56:50 -05:00
|
|
|
config.action_dispatch.default_charset = nil
|
2012-10-03 17:43:39 -04:00
|
|
|
config.action_dispatch.rack_cache = false
|
2012-11-01 18:02:09 -04:00
|
|
|
config.action_dispatch.http_auth_salt = 'http authentication'
|
|
|
|
config.action_dispatch.signed_cookie_salt = 'signed cookie'
|
|
|
|
config.action_dispatch.encrypted_cookie_salt = 'encrypted cookie'
|
|
|
|
config.action_dispatch.encrypted_signed_cookie_salt = 'signed encrypted cookie'
|
2013-12-05 06:08:34 -05:00
|
|
|
config.action_dispatch.perform_deep_munge = true
|
2011-12-01 13:16:19 -05:00
|
|
|
|
2012-08-10 22:11:56 -04:00
|
|
|
config.action_dispatch.default_headers = {
|
|
|
|
'X-Frame-Options' => 'SAMEORIGIN',
|
2012-08-18 18:29:58 -04:00
|
|
|
'X-XSS-Protection' => '1; mode=block',
|
2013-06-13 15:56:02 -04:00
|
|
|
'X-Content-Type-Options' => 'nosniff'
|
2012-08-10 22:11:56 -04:00
|
|
|
}
|
|
|
|
|
2012-08-01 14:54:22 -04:00
|
|
|
config.eager_load_namespaces << ActionDispatch
|
|
|
|
|
2010-07-27 10:39:28 -04:00
|
|
|
initializer "action_dispatch.configure" do |app|
|
|
|
|
ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length
|
2011-05-02 17:38:39 -04:00
|
|
|
ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header
|
2013-12-05 06:08:34 -05:00
|
|
|
ActionDispatch::Request::Utils.perform_deep_munge = app.config.action_dispatch.perform_deep_munge
|
2012-01-17 05:56:50 -05:00
|
|
|
ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding
|
2012-08-09 09:45:30 -04:00
|
|
|
ActionDispatch::Response.default_headers = app.config.action_dispatch.default_headers
|
2011-11-23 15:36:56 -05:00
|
|
|
|
2011-12-01 14:02:00 -05:00
|
|
|
ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses)
|
|
|
|
ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates)
|
2011-12-01 13:16:19 -05:00
|
|
|
|
2011-11-23 15:36:56 -05:00
|
|
|
config.action_dispatch.always_write_cookie = Rails.env.development? if config.action_dispatch.always_write_cookie.nil?
|
|
|
|
ActionDispatch::Cookies::CookieJar.always_write_cookie = config.action_dispatch.always_write_cookie
|
2011-12-23 11:56:49 -05:00
|
|
|
|
|
|
|
ActionDispatch.test_app = app
|
2010-07-27 10:39:28 -04:00
|
|
|
end
|
2010-01-17 06:41:55 -05:00
|
|
|
end
|
2010-07-27 22:24:56 -04:00
|
|
|
end
|