Shopify / toxiproxy

:alarm_clock: :fire: A TCP proxy to simulate network and system conditions for chaos and resiliency testing
https://github.com/shopify/toxiproxy
MIT License
10.64k stars 445 forks source link

Https ToxiProxy & Postman #223

Open amolaksandhu opened 6 years ago

amolaksandhu commented 6 years ago

Hi All,

I have an upstream https service, in which I would like to inject delay using toxiproxy. Postman ( https://x.y.com:5556/a/b/c + request ) <-> Response (works) Postman ( https://localhost:10200/ + request ) <-> ToxiProxy ( refer below ) <-> No Response

I am on macOS, Below are the settings I have tried.

Start the server ./toxiproxy-server

  1. Toxiproxy-cli create https-https --Listen localhost:10200 --upstream https://x.y.com:5556/a/b/c or
  2. Toxiproxy-cli create https-https --Listen localhost:10200 --upstream https://x.y.com/a/b/c:5556

With 1st INFO[0179] Accepted client client=127.0.0.1:49200 name https-https proxy=127.0.0.1:10200 upstream:https://x.y.com:5556/a/b/c ERRO[0179] Unable to open connection to upstream client=127.0.0.1:49200 name https-https proxy=127.0.0.1:10200 upstream:https://x.y.com:5556/a/b/c

With 2nd INFO[0179] Accepted client client=127.0.0.1:49200 name https-https proxy=127.0.0.1:10200 upstream:https://x.y.com/a/b/c:5556 ERRO[0179] Unable to open connection to upstream client=127.0.0.1:49200 name https-https proxy=127.0.0.1:10200 upstream:https://x.y.com/a/b/c:5556

Today, I am using postman as client, I would like to expand to Jmeter, Java HttpURLConnection. Can someone please guide, point to any tutorials etc.

Thanks and gratitude in advance.

xthexder commented 6 years ago

Upstream needs to be a hostname + port, not a url. Toxiproxy doesn't handle any protocol-specific proxying.

You'll need to set your upstream to x.y.com:5556 Since you're using HTTPS, you'll also have to handle the hostname mismatch for the SSL cert somehow.

There's some previous discussion about this here: https://github.com/Shopify/toxiproxy/issues/175

amolaksandhu commented 6 years ago

@xthexder Thank-you so much for the response. Your suggestion got me a step closer, afraid I need more help. Below is what I have so far.

Created toxic

Toxiproxy-cli create https-https --Listen localhost:10200 --upstream x.y.com:5556

Postman ( https://localhost:10200 + request) Could not get any response logs INFO[11863] Accepted client client=127.0.0.1:54550 name=https-https proxy=127.0.0.1:10200 upstream:x.y.com:5556 ERRO[11865] Source Terminated bytes=3453 err=read tcp 11.11.111.11:54554->222.222.22.222:5556 use of closed network connection name=https-https

Postman ( localhost:10200 + request) Could not get any response logs INFO[11863] Accepted client client=127.0.0.1:54603 name=https-https proxy=127.0.0.1:10200 upstream:x.y.com:5556 ERRO[11865] Source Terminated bytes=3453 err=read tcp 172.0.0.1:10200->127.0.0.1:54603 use of closed network connection name=https-https

PostMan stand-alone app with no certificates ( localhost:10200/a/b/c + request) Could not get any response I get a 404 Not found. CWSRV0255E: A WebGroup/Virtual Host to handle /a/b/c has not been defined.

11.11.111.11 - masked my machine IP connected to vpn. 222.222.22.222 - masked remote service IP.

Thanks and gratitude in advance.