go-simple-server

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 9 Imported by: 0

README

go-simple-server

Simple HTTP server serving domain redirects and simple pages, allowing custom headers.

Configuration

config.yaml
listen: ":8888"
logunmatched: true
rules:
  - hosts:
    - foobar.example
    - www.foobar.example
    body: "Hello World"
  - hosts:
    - foo.example
    redirect: "https://bar.example/foo"
    log: true
  - hosts:
    - bar.example
    redirect: "https://foobar.example{{ .RequestURI }}"
  - hosts:
    - root.example
    redirect: "https://domain.example{{ .RequestURI }}"
    code: 302
    headers:
      Strict-Transport-Security: "max-age=63072000; includeSubDomains; preload"
Defaults
  • Default return code is 200 for an existing host.
  • When a redirect rule is present, defaults to HTTP 301.
  • Host status defaults to HTTP 200 with body response ok (for healthchecks).
  • Unknown hosts return HTTP 404.
  • Listens on 0.0.0.0:80

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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