reverseproxy

package
v0.0.0-...-9ac85d6 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReverseProxy

type ReverseProxy struct {
	RedirectURL     url.URL
	ResponseTimeout time.Duration
	OnError         func(http.ResponseWriter, *http.Request, int) error
	Logger          *log.Entry
}

ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server (jenkins), proxying the response back to the client if it is received within a timeout (responseTimeout). In case the handler does not recieve any response from the server within the timeout, a 302 to the same URL is sent back to the client.

func NewReverseProxy

func NewReverseProxy(redirectURL url.URL, responseTimeout time.Duration, onError func(http.ResponseWriter, *http.Request, int) error, logger *log.Entry) *ReverseProxy

NewReverseProxy returns an instance of reverse proxy on passing redirect url, response timeout, session validity flag and a logger object

func (*ReverseProxy) ServeHTTP

func (rp *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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