Commit ee9da76f authored by Stan Hu's avatar Stan Hu

Merge branch 'mg-webpack-middleware-pass-host-redux' into 'master'

Pass the HTTP host header to webpack-dev-server

See merge request gitlab-org/gitlab!46795
parents 6c23a747 a88675ca
......@@ -16,14 +16,14 @@ module Gitlab
super(app, backend: "#{@proxy_scheme}://#{@proxy_host}:#{@proxy_port}", **opts)
end
# disable SSL check since any cert used here will likely be self-signed
def rewrite_env(env)
env["rack.ssl_verify_none"] = true
env
end
def perform_request(env)
if @proxy_path && env['PATH_INFO'].start_with?("/#{@proxy_path}")
# disable SSL check since any cert used here will likely be self-signed
env['rack.ssl_verify_none'] = true
# ensure we pass the expected Host header so webpack-dev-server doesn't complain
env['HTTP_HOST'] = "#{@proxy_host}:#{@proxy_port}"
if relative_url_root = Rails.application.config.relative_url_root
env['SCRIPT_NAME'] = ""
env['REQUEST_PATH'].sub!(/\A#{Regexp.escape(relative_url_root)}/, '')
......
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