Class: Webpack::DevServer::Proxy

Inherits:
Rack::Proxy
  • Object
show all
Defined in:
lib/webpack/dev_server/proxy.rb

Instance Method Summary collapse

Instance Method Details

#perform_request(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/webpack/dev_server/proxy.rb', line 8

def perform_request(env)
  if proxy?(env)
    env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = env["HTTP_X_FORWARDED_SERVER"] = dev_server.host_with_port
    env["HTTP_X_FORWARDED_PROTO"] = env["HTTP_X_FORWARDED_SCHEME"] = dev_server.protocol
    env["HTTPS"] = env["HTTP_X_FORWARDED_SSL"] = "off" unless dev_server.https?
    env["PATH_INFO"] = env["PATH_INFO"].gsub(/^#{proxy_path}/, "/")

    super(env)
  else
    @app.call(env)
  end
end