util

package
v7.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const (
	XForwardedProto = "X-Forwarded-Proto"
	XForwardedHost  = "X-Forwarded-Host"
	XForwardedURI   = "X-Forwarded-Uri"
)

Variables

This section is empty.

Functions

func CanTrustForwardedHeaders added in v7.15.2

func CanTrustForwardedHeaders(req *http.Request) bool

CanTrustForwardedHeaders determines if forwarded headers should be processed based on the RequestScope and the direct caller's address.

func GetRequestHost

func GetRequestHost(req *http.Request) string

GetRequestHost returns the request host header or X-Forwarded-Host if present and the request came from a trusted reverse proxy.

func GetRequestPath added in v7.11.0

func GetRequestPath(req *http.Request) string

GetRequestPath returns the request URI or X-Forwarded-Uri if present and the request came from a trusted reverse proxy but always strips the query parameters and fragment suffixes and only returns the pure path.

func GetRequestProto

func GetRequestProto(req *http.Request) string

GetRequestProto returns the request scheme or X-Forwarded-Proto if present and the request came from a trusted reverse proxy.

func GetRequestURI

func GetRequestURI(req *http.Request) string

GetRequestURI return the request URI or X-Forwarded-Uri if present and the request came from a trusted reverse proxy.

func IsForwardedRequest added in v7.2.0

func IsForwardedRequest(req *http.Request) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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