Sign inSign up

wwmoraes/redirector

By wwmoraes

Updated over 6 years ago

a simple golang HTTP(S) server that redirects all requests

Image
0

10K+

wwmoraes/redirector repository overview

Redirector

a simple golang HTTP(S) server that redirects all requests

Table of Contents

About

Why spin up an nginx server on a pod if you can run a standalone application to return your 301/307 redirects?

Getting Started

# run directly
go run main.go
# or build and run
go build ./... && ./redirector
# docker!
docker run -e URL=https://artero.dev wwmoraes/redirector

This server was made with love and KISS principles in mind 🖤

Usage

A single instance will run both HTTP and HTTPS servers in parallel, given that you provided valid certificate files for TLS. If not, it'll fail to start the secure one, but will still run the HTTP one.

All configurations are done using environment variables:

Variable NameDefault ValueDescription
URLdestination URL redirect to, e.g. https://artero.dev
HTTP_HOSTHTTP server host
HTTP_PORT8080HTTP server port
HTTPS_HOSTHTTPS server host
HTTPS_PORT8081HTTPS server port
KEY_FILEprivate key path for the URL certificate
KEYbase64-encoded private key contents for the URL certificate
CERT_FILEpublic key path for the URL certificate (must be the full chain if CA-signed)
CERTbase64-encoded public key contents for the URL certificate (must be the full chain if CA-signed)

Empty host equals 0.0.0.0, i.e. all interfaces will be bound.

Tag summary

Content type

Image

Digest

Size

6.5 MB

Last updated

over 6 years ago

docker pull wwmoraes/redirector