コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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));
            });
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
            });
        }
コード例 #5
0
 public HandleProxyRequestWrapper(HandleProxyRequest handleProxyRequest)
 {
     _handleProxyRequest = handleProxyRequest;
 }
コード例 #6
0
 public ProxyMiddleware(RequestDelegate _, HandleProxyRequest handleProxyRequest)
 {
     _handleProxyRequest = handleProxyRequest;
 }