proxyutil

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 13 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/

View Source
const UserHeaderName = "X-Grafana-User"

UserHeaderName name of the header used when forwarding the Grafana user login.

Variables

This section is empty.

Functions

func ApplyUserHeader

func ApplyUserHeader(sendUserHeader bool, req *http.Request, user *user.SignedInUser)

ApplyUserHeader Set the X-Grafana-User header if needed (and remove if not).

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, Origin, Referer headers. Set X-Grafana-Referer based on contents of Referer. Set X-Forwarded-For headers.

func SetProxyResponseHeaders

func SetProxyResponseHeaders(header http.Header)

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

func SetViaHeader

func SetViaHeader(header http.Header, major, minor int)

SetViaHeader adds Grafana's reverse proxy to the proxy chain. Defined in RFC 9110 7.6.3 https://datatracker.ietf.org/doc/html/rfc9110#name-via

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