Commit a88675ca authored by Mike Greiling's avatar Mike Greiling

Pass the HTTP host header to webpack-dev-server

parent 66a6e85f
...@@ -16,14 +16,14 @@ module Gitlab ...@@ -16,14 +16,14 @@ module Gitlab
super(app, backend: "#{@proxy_scheme}://#{@proxy_host}:#{@proxy_port}", **opts) super(app, backend: "#{@proxy_scheme}://#{@proxy_host}:#{@proxy_port}", **opts)
end 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) def perform_request(env)
if @proxy_path && env['PATH_INFO'].start_with?("/#{@proxy_path}") 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 if relative_url_root = Rails.application.config.relative_url_root
env['SCRIPT_NAME'] = "" env['SCRIPT_NAME'] = ""
env['REQUEST_PATH'].sub!(/\A#{Regexp.escape(relative_url_root)}/, '') 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