Example #1
0
        public Task OnExecutingAsync(ReverseProxyExecutingContext context)
        {
            // TODO: add incoming ForwardedHeadersDefaults.XForwardedForHeaderName headers like:

            /*
             * var values = context.IncomingRequest.Headers.Where(x => x.Key.Equals(ForwardedHeadersDefaults.XForwardedForHeaderName)).SelectMany(x => x.Value).ToList();
             * values.Add(context.IncomingRequest.HttpContext.Connection.RemoteIpAddress.ToString());
             * context.ProxyRequest.Headers.Add(ForwardedHeadersDefaults.XForwardedForHeaderName, values);
             */
            context.ProxyRequest.Headers.Add(ForwardedHeadersDefaults.XForwardedForHeaderName, context.IncomingRequest.HttpContext.Connection.RemoteIpAddress.ToString());
            return(Task.CompletedTask);
        }
 public Task OnExecutingAsync(ReverseProxyExecutingContext context)
 {
     context.ProxyRequest.Headers.Connection?.Clear();
     return(Task.CompletedTask);
 }
Example #3
0
 public Task OnExecutingAsync(ReverseProxyExecutingContext context)
 {
     context.ProxyRequest.Headers.Add(ForwardedHeadersDefaults.XForwardedProtoHeaderName, context.IncomingRequest.Protocol);
     return(Task.CompletedTask);
 }
Example #4
0
 public Task OnExecutingAsync(ReverseProxyExecutingContext context)
 {
     context.ProxyRequest.Headers.Host = null;
     return(Task.CompletedTask);
 }
Example #5
0
 internal static async Task OnExecutingAsync(this IList <IReverseProxyFilter> filters, ReverseProxyExecutingContext context)
 {
     if (filters == null)
     {
         return;
     }
     foreach (var filter in filters)
     {
         await filter.OnExecutingAsync(context).ConfigureAwait(false);
     }
 }