proxy

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package proxy applies X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host from trusted reverse proxies (#112, ADR-0035). Headers from any other address are ignored: a client could otherwise pick its own IP for rate limiting and logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(trusted []netip.Prefix) func(http.Handler) http.Handler

Middleware rewrites RemoteAddr, Host and the scheme of requests that come from a trusted proxy. The client is the rightmost X-Forwarded-For address that is not itself a trusted proxy, so a chain of proxies works and a forged leftmost entry is ignored. With no trusted proxies the middleware does nothing.

func ParsePrefixes

func ParsePrefixes(list []string) ([]netip.Prefix, error)

ParsePrefixes parses CIDRs and single addresses ("10.0.0.0/8", "127.0.0.1", "::1").

func Secure

func Secure(r *http.Request) bool

Secure reports whether the client reached nerdui over HTTPS: directly, or through a trusted proxy that says so with X-Forwarded-Proto.

Types

This section is empty.

Jump to

Keyboard shortcuts

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