summaryrefslogtreecommitdiff
path: root/config/initializers/static_files.rb
blob: e6d5600edb7e4f5b4f1c75cbb6915a29c311d67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
app = Gitlab::Application

if app.config.serve_static_assets
  # 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
  )
end