proxy

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

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

Proxy struct contains the mux for handling paths, rp for conditionally doing a reverse proxy to upstream and root as root directory for serving static content.

func New

func New(upstream, root string) (*Proxy, error)

New will return a Proxy struct with a new server mux and set reverse proxy Proxy.rp in case if the upstream is not empty.

func (*Proxy) Routes

func (p *Proxy) Routes(proxyPath string, stripPrefix bool, host string)

Routes will set routes based on the values of Proxy.rp and by default set / to file server.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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