diff options
author | Eliot Sykes <eliotsykes@gmail.com> | 2015-05-04 20:55:23 +0100 |
---|---|---|
committer | Eliot Sykes <eliotsykes@gmail.com> | 2015-05-28 09:41:00 +0100 |
commit | 3ff39494cdea67502dbd6465358eca3e14a84d6b (patch) | |
tree | 89e83c974e2e515de9aa12fcc09176255fa905ee /railties/lib | |
parent | 7cc9754209c0ae00d70bdd629fa4a81a1c74cc6f (diff) | |
download | rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.tar.gz rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.tar.bz2 rails-3ff39494cdea67502dbd6465358eca3e14a84d6b.zip |
config.static_index configures directory index "index.html" filename
Set `config.static_index` to serve a static directory index file not
named `index`. For example, to serve `main.html` instead of `index.html`
for directory requests, set `config.static_index` to `"main"`.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/application/default_middleware_stack.rb | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index dc3ec4274b..78a47fcda9 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -11,8 +11,8 @@ module Rails :eager_load, :exceptions_app, :file_watcher, :filter_parameters, :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, :railties_order, :relative_url_root, :secret_key_base, :secret_token, - :serve_static_files, :ssl_options, :static_cache_control, :session_options, - :time_zone, :reload_classes_only_on_change, + :serve_static_files, :ssl_options, :static_cache_control, :static_index, + :session_options, :time_zone, :reload_classes_only_on_change, :beginning_of_week, :filter_redirect, :x attr_writer :log_level @@ -28,6 +28,7 @@ module Rails @helpers_paths = [] @serve_static_files = true @static_cache_control = nil + @static_index = "index" @force_ssl = false @ssl_options = {} @session_store = :cookie_store diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index 02eea82b0c..503977b395 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -18,7 +18,7 @@ module Rails middleware.use ::Rack::Sendfile, config.action_dispatch.x_sendfile_header if config.serve_static_files - middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control + middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control, config.static_index end if rack_cache = load_rack_cache |