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 ¶
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.
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 ¶
WithHeaders sets the static headers to be injected into requests.
func WithPassHostHeader ¶
WithPassHostHeader sets whether to pass the incoming Host header to the upstream.
func WithResponseModifier ¶
WithResponseModifier sets the modifier for the response.
func WithRoundTripper ¶
func WithRoundTripper(rt http.RoundTripper) Option
WithRoundTripper sets the RoundTripper for the Forwarder.