gohttpsserver

package module
v0.0.0-...-d2efc9c Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2014 License: BSD-3-Clause Imports: 18 Imported by: 0

README

Go HTTPS Server and Proxy

Serves local files over HTTPS using a self-signed certificate. The certificate is generated when the server starts.

Usage

  1. go run cmd/https_server.go
  2. open https://localhost:8000/

Proxy

Proxies HTTPS requests to an HTTP server. Quick and dirty hack I use to test an HTTPS app locally. In production, we use nginx to decode HTTPS. This is a single binary to simulate that environment. It sends X-Forwarded-For and X-Forwarded-Proto headers, and passes through the Host header.

  1. go run cmd/https_proxy.go http://localhost:5000/
  2. open https://localhost:8001/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(addr string, certificate tls.Certificate, handler http.Handler) error

func ServeWithNewSelfSigned

func ServeWithNewSelfSigned(addr string, handler http.Handler) error

Types

type Mapping

type Mapping struct {
	Prefix string
	Target *url.URL
}

TODO: Make private?

func ParseMappings

func ParseMappings(mapping string) []*Mapping

TODO: Move elsewhere?

type ReverseProxy

type ReverseProxy struct {
	*httputil.ReverseProxy

	OverrideHost string
	// contains filtered or unexported fields
}

Wraps httputil.ReverseProxy to add additional configurable hacks

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy

func (*ReverseProxy) MapPrefix

func (proxy *ReverseProxy) MapPrefix(prefix string, target *url.URL)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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