Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

NeilQ/Netcool.HttpProxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Netcool.HttpProxy [Archived]

This GitHub project has been archived. Ongoing development on this prototype can be found in https://github.com/NeilQ/Netcool.Api/tree/master/src/extensions/Netcool.HttpProxy.

A http proxy for asp.net core app base on netstandard2.1.

Most of the codes comes from aspnet/AspLabs

Usage

public void ConfigureServices(IServiceCollection services)
{
    services.AddProxy(options =>
    {
        options.MessageHandler = new HttpClientHandler
        {
            AllowAutoRedirect = false
        };
        
        options.PrepareRequest = (originalRequest, message) =>
        {
            message.Headers.Add("X-Forwarded-Host", originalRequest.Host.Host);
            return Task.FromResult(0);
        };
    });
}

public void Configure(IApplicationBuilder app)
{
    app.Map("/api", builder => { builder.RunProxy(new Uri("http://api.domain.com")); });
}

About

A http proxy middleware for asp.net core app

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages