public ProxyMiddleware(RequestDelegate next, IOptions <ProxyOptions> options)
 {
     _next       = next;
     _options    = options.Value;
     _httpClient = new HttpClient(_options.BackChannelMessageHandler ?? new HttpClientHandler {
         AllowAutoRedirect = _options.FollowRedirects
     });
 }
 public ProxyMiddleware(RequestDelegate next, IOptions <ProxyOptions> options, IEnumerable <IProxyRule> rules)
 {
     _next    = next;
     _options = options.Value;
     _options.ProxyRules.AddRange(rules);
     _httpClient = new HttpClient(_options.BackChannelMessageHandler ?? new HttpClientHandler {
         AllowAutoRedirect = _options.FollowRedirects
     });
 }
Beispiel #3
0
 public ProxyMiddleware(RequestDelegate next, IOptions <ProxyOptions> options)
 {
     _next       = next;
     _options    = options.Value;
     _httpClient = new HttpClient(_options.BackChannelMessageHandler ?? new HttpClientHandler {
         AllowAutoRedirect      = _options.FollowRedirects,
         AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
     });
 }
 public ProxyMiddleware(RequestDelegate next, IOptions <ProxyOptions> options)
 {
     _next       = next;
     _options    = options.Value;
     _httpClient = new HttpClient(_options.BackChannelMessageHandler ?? new HttpClientHandler());
 }
 /// <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 IApplicationBuilder UseProxy(this IApplicationBuilder app, ProxyOptions proxyOptions)
 {
     return(app.UseMiddleware <ProxyMiddleware>(Options.Create(proxyOptions)));
 }