forward

package
v0.8.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

package forwarder implements http handler that forwards requests to remote server and serves back the response

Index

Constants

View Source
const (
	XForwardedProto    = "X-Forwarded-Proto"
	XForwardedFor      = "X-Forwarded-For"
	XForwardedHost     = "X-Forwarded-Host"
	XForwardedServer   = "X-Forwarded-Server"
	Connection         = "Connection"
	KeepAlive          = "Keep-Alive"
	ProxyAuthenticate  = "Proxy-Authenticate"
	ProxyAuthorization = "Proxy-Authorization"
	Te                 = "Te" // canonicalized version of "TE"
	Trailers           = "Trailers"
	TransferEncoding   = "Transfer-Encoding"
	Upgrade            = "Upgrade"
	ContentLength      = "Content-Length"
)

Variables

Hop-by-hop headers. These are removed when sent to the backend. http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html Copied from reverseproxy.go, too bad

Functions

func ErrorHandler

func ErrorHandler(h utils.ErrorHandler) optSetter

ErrorHandler is a functional argument that sets error handler of the server

func Logger

func Logger(l utils.Logger) optSetter

func Rewriter

func Rewriter(r ReqRewriter) optSetter

func RoundTripper

func RoundTripper(r http.RoundTripper) optSetter

Types

type Forwarder

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

func New

func New(setters ...optSetter) (*Forwarder, error)

func (*Forwarder) ServeHTTP

func (f *Forwarder) ServeHTTP(w http.ResponseWriter, req *http.Request)

type HeaderRewriter

type HeaderRewriter struct {
	TrustForwardHeader bool
	Hostname           string
}

Rewriter is responsible for removing hop-by-hop headers and setting forwarding headers

func (*HeaderRewriter) Rewrite

func (rw *HeaderRewriter) Rewrite(req *http.Request)

type ReqRewriter

type ReqRewriter interface {
	Rewrite(r *http.Request)
}

ReqRewriter can alter request headers and body

Jump to

Keyboard shortcuts

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