Skip to content

Proxy another api in 30 seconds from configuration

License

Notifications You must be signed in to change notification settings

trenoncourt/AutoProxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoProxy · NuGet PRs Welcome GitHub license Donate

Proxy another api in 30 seconds from configuration.

AutoProxy is a drop-in microservice for proxying another api from configuration with headers forwarding, auth, cors, impersonation and more...

You can also use AutoProxy as a middleware in your aspnet core app.

Installation

Choose between middleware or microservice

Middleware

Install-Package AutoProxy.AspNetCore

Microservice

Download the last release, drop it to your server and that's it!

Configuration

All the configuration can be made in environment variable or appsettings.json file

Just add simple json or environment based configuration like this:

"AutoProxy": {
  "Path": "proxy",
  "Proxies": [
    {
      "Name": "DuckDuck", // Required
      "BaseUrl": "https://duckduckgo.com/", // Required
      "Path": "proxy1",
      "WhiteList": "https://duckduckgo.com/api/(.*)", // Regex capable
      "Auth": {
        "Type": "Ntlm", // (Ntlm, Bearer or BasicToNtlm)
        "UseImpersonation": false,
        "User": "Jhon",
        "Password": "Doe",
        "Domain": "DoeCorp",
        "LogPassword": true // To log password with serilog
      },
      "Headers": {
        "Remove": [ "Origin", "Host" ],
        "Replace": [
          {
            "Key":  "Host",
            "Value": "duckduckgo.com"
          }
        ]
      }
    }
  ]
}

You can add multiple proxies with different path, the path for the first proxy is not required.

Api configuration

Cors

"Cors": {
  "Enabled": true, // default is false
  "Methods": "...", // default is *
  "Origins": "...", // default is *
  "Headers": "...", // default is *
}

Host

Currently only chose to use IIS integration

"Host": {
  "UseIis": true
}

Kestrel

Kestrel options, see ms doc for usage

"Kestrel": {
  "AddServerHeader": false
}

Serilog

storfiler use Serilog for logging, see serilog-settings-configuration for usage

"Serilog": {
  "MinimumLevel": {
    "Default": "Debug",
    "Override": {
      "Microsoft": "Warning",
      "System": "Warning"
    }
  },
  "WriteTo": [
    { "Name": "Console" }
  ],
  "Enrich": ["FromLogContext"]
}

About

Proxy another api in 30 seconds from configuration

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages