diff options
author | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-09-13 12:00:59 +0200 |
---|---|---|
committer | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-09-13 12:00:59 +0200 |
commit | 87d01cc3bfc12c08024881dc8f13101e5430e3e6 (patch) | |
tree | 05e82defa51500257f97e3530862da03668895e3 /config/initializers/static_files.rb | |
parent | fef5c923c009c64183cc43909444a1bdaba218b7 (diff) | |
parent | 71f3d48544cc0857c8d470b182f7e809de6a4642 (diff) | |
download | gitlab-ce-consolidate-page-widths-part02.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into consolidate-page-widths-part02consolidate-page-widths-part02
Diffstat (limited to 'config/initializers/static_files.rb')
-rw-r--r-- | config/initializers/static_files.rb | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb index 6c28686e69a..a0b8b68f3ef 100644 --- a/config/initializers/static_files.rb +++ b/config/initializers/static_files.rb @@ -1,17 +1,26 @@ app = Rails.application -if app.config.serve_static_files +if (Gitlab.rails5? && app.config.public_file_server.enabled) || app.config.serve_static_files # The `ActionDispatch::Static` middleware intercepts requests for static files # by checking if they exist in the `/public` directory. # We're replacing it with our `Gitlab::Middleware::Static` that does the same, # except ignoring `/uploads`, letting those go through to the GitLab Rails app. - app.config.middleware.swap( - ActionDispatch::Static, - Gitlab::Middleware::Static, - app.paths["public"].first, - app.config.static_cache_control - ) + if Gitlab.rails5? + app.config.middleware.swap( + ActionDispatch::Static, + Gitlab::Middleware::Static, + app.paths["public"].first, + headers: app.config.public_file_server.headers + ) + else + app.config.middleware.swap( + ActionDispatch::Static, + Gitlab::Middleware::Static, + app.paths["public"].first, + app.config.static_cache_control + ) + end # If webpack-dev-server is configured, proxy webpack's public directory # instead of looking for static assets |