Documentation
¶
Overview ¶
Package reverseproxy is a reverse proxy implementation based on the built-in httuptil.Reverseproxy. Extensions include better logging and support for injection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReverseProxy ¶
type ReverseProxy struct {
// Director must be a function which modifies
// the request into a new request to be sent
// using Transport. Its response is then copied
// back to the original client unmodified.
Director func(*http.Request)
// The transport used to perform proxy requests.
// If nil, http.DefaultTransport is used.
Transport http.RoundTripper
// FlushInterval specifies the flush interval
// to flush to the client while copying the
// response body.
// If zero, no periodic flushing is done.
FlushInterval time.Duration
Inject inject.CopyInject
}
ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.
func NewSingleHostReverseProxy ¶
func NewSingleHostReverseProxy(target *url.URL, ci inject.CopyInject) *ReverseProxy
NewSingleHostReverseProxy returns a new ReverseProxy that rewrites URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir.
func (*ReverseProxy) ServeHTTP ¶
func (p *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ReverseProxy) ServeHTTPContext ¶
func (p *ReverseProxy) ServeHTTPContext( ctx context.Context, rw http.ResponseWriter, req *http.Request, )
ServeHTTPContext serves HTTP with a context
Click to show internal directories.
Click to hide internal directories.