I'm struggling to get my http calls from a web api running on docker HTTP proxies. I successfully reached the desired endpoint through a proxy using bash
docker exec -i -t 665b4a1e17b6 /bin/bash
and
http_proxy=http://exampleProxy:7777 curl -s http://endpoint
Now I want to recreate this from an application running in the same container
I tried the following:
dotnet proxy
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
app.UseMvc().RunProxy(new ProxyOptions
{
Scheme = "http",
Host = "example",
Port = "7777"
});
Setting the http_proxy environment variable when creating the container
export http_proxy=http:
Using HttpClientHandler
var handler = new HttpClientHandler
{
Proxy = new WebProxy("http://example:777)
};
var client = new HttpClient(handler);
etc....
Can anyone think of other ways to create a proxy server? or any recommendations on how to debug this?
source
share