Introducing our new CEO Don Johnson - Read More

genhttp/gateway

By genhttp

Updated 23 days ago

Simple reverse proxy to provide various web applications over a single HTTPS entry point.

Image
Integration & Delivery
Networking
Web Servers
1

2.0K

Introduction

The GenHTTP Gateway provides a simple way to serve all your web applications over a single, HTTPS secured entry point. Compared to other reverse-proxy solutions such as Traefik, the gateway provides less features but is easier to configure for scenarios such as home servers.

Tags

TagDescription
latestMulti architecture image to run on Linux (x64 / ARM32 / ARM64) or Windows (x64)
linux-x64Alpine based image to run on Linux x64 hosts
linux-arm32Image to run on ARMv7-based Linux hosts (such as the Raspberry Pi 2)
linux-arm64Image to run on ARMv8-based Linux hosts (such as the Raspberry Pi 4)
windows-x64Image for Windows 10 / Server 2019 based on Nano Server 2004

Initial Setup

When starting the gateway via docker, an example configuration file will be created in the mounted configuration directory. Adjust this configuration file to your needs and restart the container.

docker run -d -p 80:80 \ 
              -p 443:443 \
              -v /data/gateway/config:/app/config \
              -v /data/gateway/data:/app/data \
              -v /data/gateway/certs:/app/certs \
              genhttp/gateway

Syntax for docker compositions:

services:

  gateway:
    image: genhttp/gateway
    restart: always
    volumes:
      - /data/gateway/config:/app/config
      - /data/gateway/data:/app/data
      - /data/gateway/certs:/app/certs
    ports:
      - 80:80
      - 443:443

Sample gateway.yaml configuration file:

hosts:

  domain1.com:    

    # domain1.com/...
    default:
      destination: http://10.0.0.2:8080

    routes:

      admin:

        routes:

          # domain1.com/admin/portainer/
          portainer:
            destination: http://10.0.0.2:9000

          # domain1.com/admin/pi-hole/
          pi-hole:
            destination: http://10.0.0.3/admin/

          # domain1.com/admin/files/
          # directory browsing of files (requires the target path to be available through a volume)
          files:
            listing: /data/files/
          
          # domain1.com/admin/content/
          # static content to be served (requires the target path to be available through a volume)
          content:
            directory: /data/content/
            index: index.html # optional

    security:
      certificate:
        pfx: domain1.com.pfx

Volumes

The following volumes are available in this image:

VolumeDescription
/app/configThe configuration files of the gateway
/app/certsThe certificates to be used for SSL/TLS
/app/dataAdditional data such as the .well-known folder

For Windows volume paths, see the section below.

SSL / Let's Encrypt

The gateway can be used with certbot to generate SSL certificates:

certbot certonly --webroot -w /data/gateway/data/ -d domain1.com

Currently, only PFX certificates are supported by the gateway. Run the following command to convert the certificates generated by certbot and copy the resulting file into the mounted certificate folder.

openssl pkcs12 -export -out /data/gateway/certs/domain1.com.pfx -inkey privkey.pem -in fullchain.pem

Volumes on Windows

When running a Windows based image, the volume path format differs:

docker run -d -p 80:80 ^
              -p 443:443 ^
              -v C:\Data\Gateway\Config:C:/App/Config ^
              -v C:\Data\Gateway\Data:C:/App/Data ^
              -v C:\Data\Gateway\Certs:C:/App/Certs ^
              genhttp/gateway

Docker Pull Command

docker pull genhttp/gateway