debian-mirror-gitlab/config/initializers/static_files.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.3 KiB
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2015-12-23 02:04:40 +05:30
app = Rails.application
2015-04-26 12:48:37 +05:30
2021-11-11 11:23:49 +05:30
# Disable Sendfile for Sidekiq Web assets since Workhorse won't
# always have access to these files.
app.config.middleware.insert_before(Rack::Sendfile, Gitlab::Middleware::SidekiqWebStatic)
2019-02-15 15:39:39 +05:30
if app.config.public_file_server.enabled
2018-03-17 18:26:18 +05:30
# The `ActionDispatch::Static` middleware intercepts requests for static files
# by checking if they exist in the `/public` directory.
2015-04-26 12:48:37 +05:30
# 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.
2019-02-15 15:39:39 +05:30
app.config.middleware.swap(
ActionDispatch::Static,
Gitlab::Middleware::Static,
app.paths["public"].first,
headers: app.config.public_file_server.headers
)
2017-08-17 22:00:37 +05:30
# If webpack-dev-server is configured, proxy webpack's public directory
# instead of looking for static assets
2022-08-27 11:52:29 +05:30
if Gitlab.config.webpack.dev_server.enabled && Gitlab.dev_or_test_env?
2021-01-03 14:25:43 +05:30
app.config.middleware.insert_before(
Gitlab::Middleware::Static,
Gitlab::Webpack::DevServerMiddleware,
proxy_path: Gitlab.config.webpack.public_path,
proxy_host: Gitlab.config.webpack.dev_server.host,
proxy_port: Gitlab.config.webpack.dev_server.port,
proxy_https: Gitlab.config.webpack.dev_server.https
)
2017-08-17 22:00:37 +05:30
end
2015-04-26 12:48:37 +05:30
end