Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused errors should return response with 502 status code #58

Open
andrewhavens opened this issue Nov 15, 2016 · 2 comments

Comments

@andrewhavens
Copy link

I'm working with a gem that uses rack-proxy as a dependency. However, requests that fail to connect are resulting in errors being raised:

Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:6003 (Connection refused - connect(2) for "127.0.0.1" port 6003)
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/net/http.rb:878:in `connect'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/net/http.rb:863:in `do_start'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/2.3.0/net/http.rb:858:in `start'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-proxy-0.6.0/lib/rack/http_streaming_response.rb:70:in `session'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-proxy-0.6.0/lib/rack/http_streaming_response.rb:59:in `response'
/Users/andrew/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rack-proxy-0.6.0/lib/rack/http_streaming_response.rb:21:in `code'

Since rack-proxy is making the request, it should be responsible for forwarding along the correct status code. In this case, it seems like returning a 502 status code is appropriate.

@gogolok
Copy link

gogolok commented Jul 3, 2017

👍

1 similar comment
@maca
Copy link

maca commented Jul 18, 2018

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants