httpsproxy

package
v0.0.0-...-56f983d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 8 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 is a HTTPS reverse proxy. It is a man-in-the-middle proxy that intercepts and redirects requests to a HTTP host. It can optional forward the requests that match a list of path prefixes to the real HTTPS server.

func New

func New(cert tls.Certificate, targetHost, nextHost string, prefixes []string) (*Proxy, error)

New returns a new HTTPS reverse proxy to a HTTP host, with an list of path prefixes that should be forwarded to the nextHost.

func (*Proxy) ServeHTTP

func (hp *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP forwards requests to the next host if its path matches the given list of prefixes, otherwise it forwards the request to the masquerading HTTP host.

func (*Proxy) StartServer

func (hp *Proxy) StartServer() (string, error)

StartServer starts a HTTPS server for the reverse proxy.

Jump to

Keyboard shortcuts

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