reproxied

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

ReProxied

ReProxied is a middleware plugin for Traefik to route an incoming request through a proxy. Be aware that this middleware initiates the call to the proxy and any middlewares after this one will be skipped. If the request to the proxy itself fails the middleware will respond with a 502 bad gateway response.

When set to true the parameter keepHostHeader allow to keep original Host as HTTP header even if proxied request target any other host.

Configuration

Static
pilot:
  token: "xxxxx"

experimental:
  plugins:
    reproxied:
      moduleName: "github.com/RouxAntoine/reproxied"
      version: "v0.0.5"
      keepHostHeader: true|false # optional, false by default
      logLevel: 1,2,3,4,5  # optional, 2 by default. 1 -> debug, 4 -> error, 5 -> off
Dynamic
http:
  middlewares:
    reproxied-foo:
      reproxied:
        proxy: http://proxyHost:3128
        targetHost: https://example.com
        keepHostHeader: true|false # optional, false by default
        logLevel: 1,2,3,4,5  # optional, 2 by default. 1 -> debug, 4 -> error, 5 -> off

log level are defined in Levels.go

Documentation

Overview

Package reproxied is a plugin

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New creates a new reProxied plugin.

func NewWithRoundTripperAndWriter

func NewWithRoundTripperAndWriter(_ context.Context, next http.Handler, config *Config, name string, transport http.RoundTripper, loggingWriter logging.Writer) (http.Handler, error)

NewWithRoundTripperAndWriter creates a new reProxied plugin.

Types

type Config

type Config struct {
	Proxy          string        `json:"proxy"`
	TargetHost     string        `json:"targetHost"`
	KeepHostHeader bool          `json:"keepHostHeader"`
	LogLevel       logging.Level `json:"logLevel,omitempty"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

Directories

Path Synopsis
internal
logging
Package logging implements leveled logging mechanism
Package logging implements leveled logging mechanism

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL