mdevilliers / Toxiproxy.Net

Toxiproxy.Net is a .Net client for Shopify's Toxiproxy. Toxiproxy is a proxy to test your system by simulating network failure.
MIT License
52 stars 10 forks source link

Does not work with Heroku? #17

Closed mneil closed 6 years ago

mneil commented 6 years ago

I am trying to setup a basic proxy of an api call from a .net application to Heroku. Here is my test:

public IEnumerator CacheNewExperience()
        {
            using(var connection = new Connection(true))
            {
                var client = connection.Client();
                var localToSomeApp = new Proxy()
                {
                    Name = "localToSomeApp",
                    Enabled = true,
                    Listen = "127.0.0.1:22220",
                    Upstream = "someapp.herokuapp.com"
                };
                client.Add(localToSomeApp);

                bool finished = false;
                SomeApp.Client SomeAppClient = SomeAppClient();
                RExperience req = new RExperience
                {
                    type = "unity_test",
                    activationId = "some-id"
                };

                var query = SomeAppClient.Post<RExperience>(req);
                query.ResponseReceived += (RExperience[] experiences, Request<RExperience> request) =>
                {
                    Assert.AreEqual("unity_test", experiences[0].type);
                    finished = true;
                };
                while (!finished)
                    yield return null;

                yield return null;

            }            
        }

I've altered some names of code here to keep my heroku app hidden a bit but the details are:

I am getting a 404 from Heroku saying app not found.

I inspected with wireshark and I think the issue is the original URI that I'm requesting is getting parsed by heroku to try and find my app.

request uri

mdevilliers commented 6 years ago

Hey - this looks interesting but I'm not too sure where to start.

Could you validate if you can set up a proxy for your heroku application using the toxiproxy-cli from https://github.com/Shopify/toxiproxy ?

All this project really does is drive the administration of the proxy configuration. Of course if you can use the cli and not this project for the same steps then we have a problem.

Mark

mneil commented 6 years ago

I'm not able to use the cli at all to connect so I must be doing something wrong.

"toxiproxy-server-2.1.2-windows-amd64.exe" create testToHeroku -l 127.0.0.1:22220 -u mytestapp.herokuapp.com

I would expect opening my browser to http://127.0.0.1:22220 would proxy my request and serve my heroku app homepage. For now I'm going to give up since I can hit my production servers by IP for these initial tests. I'll try to circle back around with the team on the toxiproxy core app.

Thanks!