public ProxyMiddleware(AppFunc next, ProxyOptions options) { _next = next; _options = options; _httpClient = new HttpClient(_options.BackChannelMessageHandler ?? new HttpClientHandler { AllowAutoRedirect = _options.FollowRedirects, UseProxy = options.UseExternalProxy, Proxy = options.ExternalProxy, PreAuthenticate = options.ExternalProxyPreAuthenticate, }); }
/// <summary> /// Sends request to remote server as specified in options /// </summary> /// <param name="app"></param> /// <param name="proxyOptions">Options and rules for proxy actions</param> /// <returns></returns> public static IAppBuilder UseProxy(this IAppBuilder app, ProxyOptions proxyOptions) { return(app.Use <ProxyMiddleware>(proxyOptions)); }