Merge branch 'fix-webpack-dev-server-proxy' into 'master'

Fix webpack dev server when behind proxy

See merge request !9543
This commit is contained in:
Douwe Maan 2017-02-27 17:31:36 +00:00
commit 34685c588a
1 changed files with 6 additions and 6 deletions

View File

@ -8,16 +8,16 @@ module Gitlab
@proxy_host = opts.fetch(:proxy_host, 'localhost')
@proxy_port = opts.fetch(:proxy_port, 3808)
@proxy_path = opts[:proxy_path] if opts[:proxy_path]
super(app, opts)
super(app, backend: "http://#{proxy_host}:#{proxy_port}", **opts)
end
def perform_request(env)
unless @proxy_path && env['PATH_INFO'].start_with?("/#{@proxy_path}")
return @app.call(env)
if @proxy_path && env['PATH_INFO'].start_with?("/#{@proxy_path}")
super(env)
else
@app.call(env)
end
env['HTTP_HOST'] = "#{@proxy_host}:#{@proxy_port}"
super(env)
end
end
end