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

Rack::Proxy#call method hangs #66

Closed
amitfriedman12 opened this issue Jul 26, 2017 · 3 comments
Closed

Rack::Proxy#call method hangs #66

amitfriedman12 opened this issue Jul 26, 2017 · 3 comments

Comments

@amitfriedman12
Copy link

amitfriedman12 commented Jul 26, 2017

I have a custom class that overwrites the default Rack::Proxy functionality:

module Middleware
  class SOAProxy < Rack::Proxy

    attr_reader :app

    def initialize(app)
      @app = app
    end

    def call(env)
      if some_condition_is_met
        write_authorization_token(env)
        rewrite_proxy_host(env, proxy_host)
        rewrite_request_path(env)
        super(env)
      else
        app.call(env)
      end
    end

However I am having an issue that occurs when the super(env) code gets executed.
Even after the local server which i hit with my API call returns a 200 response, the call method does not finish executing for another 5-10 seconds or so.

After looking into it, this is where the API call is made and where the hanging occurs.
I would expect the call the http request to finish executing as soon as the local server returns the 200 response, but instead the code continues executing a few seconds later.

Any ideas how to further debug this?
Using rails 3.2.16 and ruby 2.3.3.

@velles
Copy link

velles commented Jul 28, 2017

Few more details on this issue:

  1. Fast Proxy - respond immediately after the targeting server is done - Rails 3.2.16 proxies to Rails
    4 with puma server
  2. Slow Proxy - respond takes 20-30s after the targeting server is done - Rails 3.2.16 proxies to
    Rails 5 API with puma server

@kenzan100
Copy link

Did you guys find out what was the issue here?

@kenzan100
Copy link

#fyi for my case it was related to the header Connection: KeepAlive as per axsuul/rails-reverse-proxy#34

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