proxy

package module
v6.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 13 Imported by: 0

README

Documentation

Overview

Package proxy provides an HTTP middleware plugin for RoadRunner that resolves the real client IP address from proxy headers (Forwarded, X-Forwarded-For, X-Real-Ip, True-Client-Ip, Cf-Connecting-Ip) when requests arrive through trusted subnets.

The headers consulted are configurable via http.trusted_headers: an ordered allowlist where the first non-empty match wins. When it is unset, the headers above are used in that default order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TrustedSubnets declare IP subnets which are allowed to set ip using X-Real-Ip and X-Forwarded-For
	TrustedSubnets []string `mapstructure:"trusted_subnets"`
	// TrustedHeaders is the ordered allowlist of headers consulted to resolve the
	// real client IP. When empty, the built-in default order is used.
	TrustedHeaders []string `mapstructure:"trusted_headers"`
}

type Configurer

type Configurer interface {
	// UnmarshalKey takes a single key and unmarshal it into a Struct.
	UnmarshalKey(name string, out any) error
	// Has checks if a config section exists.
	Has(name string) bool
}

type Logger

type Logger interface {
	NamedLogger(name string) *slog.Logger
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Init

func (p *Plugin) Init(cfg Configurer, l Logger) error

func (*Plugin) Middleware

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

func (*Plugin) Name

func (p *Plugin) Name() string

Jump to

Keyboard shortcuts

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