Commit 6927efac authored by Stan Hu's avatar Stan Hu

Revert "Revert "Proxy webpack dev server in test environment""

This restores the changes in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79457 by
reverting a2ba70ec.

The root cause should have be solved by the upgrade to rack-proxy
(https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83241). This
upgrade should prevent chunked transfers from being proxied through
Workhorse.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/352649
parent 5e54d449
......@@ -83,16 +83,8 @@ module WebpackHelper
end
def webpack_public_host
# We do not proxy the webpack output in the 'test' environment,
# so we must reference the webpack dev server directly.
if Rails.env.test? && Gitlab.config.webpack.dev_server.enabled
host = Gitlab.config.webpack.dev_server.host
port = Gitlab.config.webpack.dev_server.port
protocol = Gitlab.config.webpack.dev_server.https ? 'https' : 'http'
"#{protocol}://#{host}:#{port}"
else
ActionController::Base.asset_host.try(:chomp, '/')
end
# We proxy webpack output in 'test' and 'dev' environment, so we can just use asset_host
ActionController::Base.asset_host.try(:chomp, '/')
end
def webpack_public_path
......
......@@ -21,7 +21,7 @@ if app.config.public_file_server.enabled
# If webpack-dev-server is configured, proxy webpack's public directory
# instead of looking for static assets
if Gitlab.config.webpack.dev_server.enabled && Rails.env.development?
if Gitlab.config.webpack.dev_server.enabled && Gitlab.dev_or_test_env?
app.config.middleware.insert_before(
Gitlab::Middleware::Static,
Gitlab::Webpack::DevServerMiddleware,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment