/// <summary> /// Runs proxy forwarding requests to downstream server. /// </summary> /// <param name="app"> /// The application builder. /// </param> /// <param name="handleProxyRequest"> /// A delegate that can resolve the destination Uri. /// </param> public static void RunProxy( this IApplicationBuilder app, HandleProxyRequest handleProxyRequest) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.UseMiddleware <ProxyMiddleware>(handleProxyRequest); }
public static void RunProxy( this IApplicationBuilder app, PathString pathMatch, HandleProxyRequest handleProxyRequest) { if (app == null) { throw new ArgumentNullException(nameof(app)); } app.Map(pathMatch, appInner => { appInner.UseMiddleware <ProxyMiddleware <HandleProxyRequestWrapper> >(new HandleProxyRequestWrapper(handleProxyRequest)); }); }
/// <summary> /// Runs proxy forwarding requests to downstream server. /// </summary> /// <param name="app"> /// The application builder. /// </param> /// <param name="handleProxyRequest"> /// A delegate that can resolve the destination Uri. /// </param> public static void RunProxy( this IApplicationBuilder app, HandleProxyRequest handleProxyRequest) { if (app == null) { throw new ArgumentNullException(nameof(app)); } var proxyOptions = new ProxyOptions { HandleProxyRequest = handleProxyRequest, }; app.UseMiddleware <ProxyMiddleware>(proxyOptions); }
/// <summary> /// Runs proxy forwarding requests to downstream server. /// </summary> /// <param name="app"> /// The application builder. /// </param> /// <param name="pathMatch"> /// Branches the request pipeline based on matches of the given /// request path. If the request path starts with the given path, /// the branch is executed. /// </param> /// <param name="handleProxyRequest"> /// A delegate that can resolve the destination Uri. /// </param> public static void RunProxy( this IApplicationBuilder app, PathString pathMatch, HandleProxyRequest handleProxyRequest) { if (app == null) { throw new ArgumentNullException(nameof(app)); } var proxyOptions = new ProxyOptions { HandleProxyRequest = handleProxyRequest, }; app.Map(pathMatch, appInner => { appInner.UseMiddleware <ProxyMiddleware>(proxyOptions); }); }
public HandleProxyRequestWrapper(HandleProxyRequest handleProxyRequest) { _handleProxyRequest = handleProxyRequest; }
public ProxyMiddleware(RequestDelegate _, HandleProxyRequest handleProxyRequest) { _handleProxyRequest = handleProxyRequest; }