reverseproxy

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package reverseproxy provides a Teleport-inspired HTTP reverse proxy.

Package reverseproxy provides a Teleport-inspired HTTP reverse proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSHandler

func CORSHandler(cfg *apps.CORSConfig) func(http.Handler) http.Handler

CORSHandler handles CORS preflight requests.

func NewErrorHandler

func NewErrorHandler() func(http.ResponseWriter, *http.Request, error)

NewErrorHandler returns a handler for proxy errors.

Types

type Forwarder

type Forwarder struct {
	*httputil.ReverseProxy
	PassHostHeader bool
	Headers        map[string]string
}

Forwarder wraps httputil.ReverseProxy.

func New

func New(target *url.URL, opts ...Option) *Forwarder

New creates a new Forwarder.

type HeaderRewriter

type HeaderRewriter struct {
	TrustForwardHeaders bool
}

HeaderRewriter rewrites headers for the request.

func (*HeaderRewriter) Rewrite

func (r *HeaderRewriter) Rewrite(req *http.Request)

Rewrite rewrites request headers.

type Option

type Option func(*Forwarder)

Option configures the Forwarder.

func WithHeaders

func WithHeaders(headers map[string]string) Option

WithHeaders sets the static headers to be injected into requests.

func WithPassHostHeader

func WithPassHostHeader(pass bool) Option

WithPassHostHeader sets whether to pass the incoming Host header to the upstream.

func WithResponseModifier

func WithResponseModifier(fn func(*http.Response) error) Option

WithResponseModifier sets the modifier for the response.

func WithRoundTripper

func WithRoundTripper(rt http.RoundTripper) Option

WithRoundTripper sets the RoundTripper for the Forwarder.

Jump to

Keyboard shortcuts

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