reverse_proxy

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilUpstreamUrl    = errors.New("upstream url cannot be nil")
	ErrEmptyProxyPattern = errors.New("proxy pattern cannot be empty")
)

Functions

This section is empty.

Types

type Builder

type Builder interface {
	// FlushInterval sets the flush interval for flushable response bodies.
	FlushInterval(time.Duration) Builder

	// Rewrite sets the rewrite function for the reverse proxy.
	CustomRewrite(RewriteFunc) Builder

	// ModifyResponse sets the modify response function for the reverse proxy.
	ModifyResponse(ModifyResponseFunc) Builder

	// ErrorHandler sets the error handler function for the reverse proxy.
	ErrorHandler(ErrorHandlerFunc) Builder

	// Transport sets the transport for the reverse proxy.
	Transport(http.RoundTripper) Builder

	// ErrorLogger sets the (go) logger for the reverse proxy.
	ErrorLogger(*log.Logger) Builder

	// ProxyRewrite sets the proxy rewrite function for the reverse proxy.
	ProxyRewrite(
		stripPath bool,
		preserveHost bool,
		disableQueryParams bool,
		xForwardedHeaders bool,
	) Builder

	// Build builds the reverse proxy executor.
	Build(
		upstreamUrl *url.URL,
		proxyPattern string,
	) (http.Handler, error)

	// Clone clones the builder.
	Clone() Builder
}

func NewBuilder

func NewBuilder() Builder

type ErrorHandlerFunc

type ErrorHandlerFunc func(http.ResponseWriter, *http.Request, error)

type ModifyResponseFunc

type ModifyResponseFunc func(*http.Response) error

type RewriteFunc

type RewriteFunc func(*http.Request, *http.Request)

Jump to

Keyboard shortcuts

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