proxyutil

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const StatusClientClosedRequest = 499

StatusClientClosedRequest A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request. https://httpstatus.in/499/

Variables

This section is empty.

Functions

func ClearCookieHeader

func ClearCookieHeader(req *http.Request, keepCookiesNames []string, skipCookiesNames []string)

ClearCookieHeader clear cookie header, except for cookies specified to be kept (keepCookiesNames) if not in skipCookiesNames.

func NewReverseProxy

func NewReverseProxy(logger glog.Logger, director func(*http.Request), opts ...ReverseProxyOption) *httputil.ReverseProxy

NewReverseProxy creates a new httputil.ReverseProxy with sane default configuration.

func PrepareProxyRequest

func PrepareProxyRequest(req *http.Request)

PrepareProxyRequest prepares a request for being proxied. Removes X-Forwarded-Host, X-Forwarded-Port, X-Forwarded-Proto headers. Set X-Forwarded-For headers.

func SetProxyResponseHeaders

func SetProxyResponseHeaders(header http.Header)

SetProxyResponseHeaders sets proxy response headers. Sets Content-Security-Policy: sandbox

Types

type ReverseProxyOption

type ReverseProxyOption func(*httputil.ReverseProxy)

ReverseProxyOption reverse proxy option to configure a httputil.ReverseProxy.

func WithModifyResponse

func WithModifyResponse(fn func(*http.Response) error) ReverseProxyOption

func WithTransport

func WithTransport(transport http.RoundTripper) ReverseProxyOption

Jump to

Keyboard shortcuts

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