install_controller proxy issue(and its solution)

Subscribe to install_controller proxy issue(and its solution) 2 post(s), 2 voice(s)

 
Avatar yKondou 2 post(s)

If your Warehouse server is inside proxy environment, you must set proxy configurations(host, port and so on) on your systems and applications.

But, Warehouse app/controllers/install_controller.rb is not supported proxy configurations.

So this cases, registering operation fails.

To solve this issue, add below codes around app/controllers/install_controller.rb #25


#res = Net::HTTP.post_form(URI.parse(Warehouse.forum_url % params[:license]), 'install[domain]' => params[:domain])
#if res.code != '200'
#  raise res.body
#end
proxy = URI.parse(ENV['http_proxy'])
license_uri = URI.parse(Warehouse.forum_url % params[:license])
http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new(license_uri.host)
res = nil
http.start do |ht|
  res = ht.post(license_uri.path, "install[domain]=#{params[:domain]}")
end
unless res and res.code == '200'
  raise res.body
end

ENV['http_proxy'] takes values like this:
http ://proxy_user:proxy_password@proxy_host:proxy_port

 
Avatar rick Administator 546 post(s)

Thanks! I’ll work this into Warehouse 1.1.