4
我正在努力從運行在docker容器代理http請求上的web api獲取我的http調用。我使用bash我如何代理在Docker容器中運行的一個dotnet核心應用程序的每個請求
docker exec -i -t 665b4a1e17b6 /bin/bash
和
http_proxy=http://exampleProxy:7777 curl -s http://endpoint
成功殺入通過代理所需的端點現在我想從同一個容器上運行的應用程序中創建此
我曾嘗試以下:
-
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc().RunProxy(new ProxyOptions { Scheme = "http", Host = "example", Port = "7777" });
設置在容器創建
export http_proxy=http://example:7777
環境變量http_proxy使用HttpClientHandler
var handler = new HttpClientHandler { Proxy = new WebProxy("http://example:777) }; var client = new HttpClient(handler); etc....
誰能想到其他的方法來設置代理?或者有關如何調試的建議?