Commit 90ac1590 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'sh-fix-webpack-and-thin' into 'master'

Fix Webpack manifest not working with single-threaded Web servers

See merge request gitlab-org/gitlab!43781
parents 63a28a1e 891f7b5a
...@@ -21,12 +21,12 @@ if app.config.public_file_server.enabled ...@@ -21,12 +21,12 @@ if app.config.public_file_server.enabled
settings = { settings = {
enabled: true, enabled: true,
host: dev_server.host, host: dev_server.host,
manifest_host: dev_server.host,
manifest_port: dev_server.port,
port: dev_server.port port: dev_server.port
} }
if Rails.env.development? if Rails.env.development?
# /assets are proxied through a Rails middlware to the Webpack
# server, so we have to use the local Rails settings.
settings.merge!( settings.merge!(
host: Gitlab.config.gitlab.host, host: Gitlab.config.gitlab.host,
port: Gitlab.config.gitlab.port, port: Gitlab.config.gitlab.port,
......
...@@ -88,10 +88,9 @@ module Gitlab ...@@ -88,10 +88,9 @@ module Gitlab
end end
def load_dev_server_manifest def load_dev_server_manifest
host = ::Rails.configuration.webpack.dev_server.host host = ::Rails.configuration.webpack.dev_server.manifest_host
port = ::Rails.configuration.webpack.dev_server.port port = ::Rails.configuration.webpack.dev_server.manifest_port
scheme = ::Rails.configuration.webpack.dev_server.https ? 'https' : 'http' uri = Addressable::URI.new(scheme: 'http', host: host, port: port, path: dev_server_path)
uri = Addressable::URI.new(scheme: scheme, host: host, port: port, path: dev_server_path)
# localhost could be blocked via Gitlab::HTTP # localhost could be blocked via Gitlab::HTTP
response = HTTParty.get(uri.to_s, verify: false) # rubocop:disable Gitlab/HTTParty response = HTTParty.get(uri.to_s, verify: false) # rubocop:disable Gitlab/HTTParty
......
...@@ -41,7 +41,9 @@ RSpec.describe Gitlab::Webpack::Manifest do ...@@ -41,7 +41,9 @@ RSpec.describe Gitlab::Webpack::Manifest do
before do before do
# Test that config variables work while we're here # Test that config variables work while we're here
::Rails.configuration.webpack.dev_server.host = 'hostname' ::Rails.configuration.webpack.dev_server.host = 'hostname'
::Rails.configuration.webpack.dev_server.port = 2000 ::Rails.configuration.webpack.dev_server.port = 1999
::Rails.configuration.webpack.dev_server.manifest_host = 'hostname'
::Rails.configuration.webpack.dev_server.manifest_port = 2000
::Rails.configuration.webpack.manifest_filename = "my_manifest.json" ::Rails.configuration.webpack.manifest_filename = "my_manifest.json"
::Rails.configuration.webpack.public_path = "public_path" ::Rails.configuration.webpack.public_path = "public_path"
::Rails.configuration.webpack.output_dir = "manifest_output" ::Rails.configuration.webpack.output_dir = "manifest_output"
......
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