proxy_headers

package
v0.0.0-...-6ad7431 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootPluginName = "http"
	PluginName     = "proxy_headers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct{}

func (*Plugin) Handle

func (p *Plugin) Handle(next http.Handler) http.Handler

Handle inspects common reverse proxy headers and sets the corresponding fields in the HTTP request struct. These are X-Forwarded-For and X-Real-IP for the remote (client) IP address, X-Forwarded-Proto or X-Forwarded-Scheme for the scheme (http|https), X-Forwarded-Host for the host and the RFC7239 Forwarded header, which may include both client IPs and schemes.

NOTE: This middleware should only be used when behind a reverse proxy like nginx, HAProxy or Apache. Reverse proxies that don't (or are configured not to) strip these headers from client requests, or where these headers are accepted "as is" from a remote client (e.g. when Go is not behind a proxy), can manifest as a vulnerability if your application uses these headers for validating the 'trustworthiness' of a request.

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer) error

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns user-friendly plugin name

Jump to

Keyboard shortcuts

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