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

Client cannot connect to proxy even if upstream is down #265

Open
ElasticCoder opened this issue Nov 18, 2019 · 3 comments
Open

Client cannot connect to proxy even if upstream is down #265

ElasticCoder opened this issue Nov 18, 2019 · 3 comments
Labels

Comments

@ElasticCoder
Copy link

ElasticCoder commented Nov 18, 2019

I am able to connect my client to the proxy even if the upstream server socket is not accepting connections. This means I cannot test all my use cases (e.g. server is absent) because the proxy will accept the connection on behalf of the upstream. When I go to send data it errors, but I would rather the socket is not accepted if upstream is down.

An alternative would be if the upstream rule is disabled then the proxy does not accept connections for that rule.

Behaving in this manner would change the code in which the server accepts connections. During the acceptance, the server would either:

  1. attempt a connection to upstream and refuse the client if that server could not be established, or
  2. verify the rules and if enabled was false it would reject the connection
@miry
Copy link
Contributor

miry commented Nov 6, 2021

@ElasticCoder I would like to understand the test scenario for this case. Pls correct me if I understand correctly?

  1. Run Upstream application and listen for port 8080
  2. Run Toxiproxy server
  3. Add a proxy to forward packets from port 8081 to 8080
  4. Terminate upstream application
  5. Open a TCP connection to 8081 would return NO port available: port 8081: Connection refused

@miry
Copy link
Contributor

miry commented Nov 6, 2021

Currently, it is possible to simulate a closed port behavior with toggle feature.

$ toxiproxy-cli create -l 0.0.0.0:20000 -u google.com:443 google_https

$ curl localhost:23232
curl: (7) Failed to connect to localhost port 23232: Connection refused
$ curl localhost:20000
curl: (52) Empty reply from server

$ toxiproxy-cli tog google_https

$ curl localhost:20000
curl: (7) Failed to connect to localhost port 20000: Connection refused

@miry
Copy link
Contributor

miry commented Nov 6, 2021

Idea how to toggle automatically, it is when the Upstream gracefully shutdown the connection, then server should switch stated to Disabled. But it would require user to toggle back in case upstream restored.

@miry miry added the ideas label Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants