proxy

package
v0.0.0-...-194be0d Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proxy provides a more featureful abstraction on top of httputil.ReverseProxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieInterceptFunc

type CookieInterceptFunc = func(setCookie string) string

type CookieInterceptor

type CookieInterceptor struct {
	// contains filtered or unexported fields
}

CookieInterceptor intercepts header writes to modify cookies.

func NewCookieInterceptor

func NewCookieInterceptor(changer CookieInterceptFunc) CookieInterceptor

func (CookieInterceptor) NewWriter

type HTMLMutator

type HTMLMutator struct {
	// contains filtered or unexported fields
}

HTMLMutator provides a wrapper around ResponseWriter to mutate HTML.

func NewHTMLMutator

func NewHTMLMutator(mutator htmlmut.MutateFunc) HTMLMutator

func (HTMLMutator) NewWriter

type HTMLMutatorWriter

type HTMLMutatorWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*HTMLMutatorWriter) ApplyHTML

func (muwr *HTMLMutatorWriter) ApplyHTML() error

ApplyHTML applies the mutator and flushes the body.

func (*HTMLMutatorWriter) Write

func (muwr *HTMLMutatorWriter) Write(b []byte) (int, error)

func (*HTMLMutatorWriter) WriteHeader

func (muwr *HTMLMutatorWriter) WriteHeader(statusCode int)

type ReverseProxy

type ReverseProxy struct {
	*httputil.ReverseProxy
	// contains filtered or unexported fields
}

func NewReverseProxy

func NewReverseProxy(target url.URL, htmlMutator htmlmut.MutateFunc) *ReverseProxy

func (*ReverseProxy) ServeHTTP

func (rp *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves the reverse proxy. If the request has a path that starts with the previously given targetURL, the server will 301 redirect that to a request with the path trimmed.

Jump to

Keyboard shortcuts

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