Skip to content
ASP.NET Core middleware to establish endpoints which proxy to another server, e.g. forward API calls
C# Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/GlacierCrates.AspNetCore.ApiProxy
test/GlacierCrates.AspnetCore.ApiProxy.Test
.gitignore
ApiProxy.sln
LICENSE
README.md
global.json

README.md

GlacierCrates.AspNetCore.ApiProxy

ASP.NET Core middleware to establish endpoints which proxy to another server, e.g. forward API calls.

Inspired by

Freely available under the terms of the MIT license.

Installation

You can install GlacierCrates.AspNetCore.ApiProxy via nuget using the UI or the Package Manager Console

Install-Package GlacierCrates.AspNetCore.ApiProxy

Configuration

In your Configure method you can setup the proxy like this:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();

    var options = new ApiProxyOptions();
    options.ProxiedEndpoints = new[] { new ApiEndpointOption() { Endpoint = "/api2", Host = "localhost", TargetEndpoint = "/api" } };
    app.RunApiProxy(options);

    app.UseMvc();
}

For the endpoint options all parameters except Endpoint are optional and default to the current request or localhost or port 80.

You can’t perform that action at this time.