Documentation ¶
Index ¶
- Constants
- func ApplyUserHeader(sendUserHeader bool, req *http.Request, user *user.SignedInUser)
- func ClearCookieHeader(req *http.Request, keepCookiesNames []string, skipCookiesNames []string)
- func NewReverseProxy(logger glog.Logger, director func(*http.Request), opts ...ReverseProxyOption) *httputil.ReverseProxy
- func PrepareProxyRequest(req *http.Request)
- func SetProxyResponseHeaders(header http.Header)
- type ReverseProxyOption
Constants ¶
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/
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 ¶
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 ¶
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 ¶
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