goginx

command module
v0.0.0-...-9aca140 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 2 Imported by: 0

README

Actions Status Go Report Card

Goginx

A simpler version of Nginx, BUT MORE.

Features

  • Upstreams
  • Discovery Server (POST /discovery { service, host, port })
  • Custom HTTP Headers
  • File Server
  • Whitelist
  • Compression
  • CORS
  • Secure HTTP Headers
  • Remote configuration file
  • Timeout
  • Cache
  • Logging

Installation

  • Install golang
  • Install goreleaser
  • Install make
go get
make build

Goginx Configuration

Run using

goginx -c config.json
goginx -c https://<fileuploadserver.io>/config.json

or if you have goginx.json in the current directory

goginx

Help Menu

Usage of goginx:
  -V    Validate configuration file
  -c string
        Goginx configuration file location (default "goginx.json")
  -h    Print this help

Basic Sample goginx.json file

{
    "routes" : [
        {
            "path" : "/search",
            "forwardUrl" : "https://httpbin.org/anything",
            "allowedMethods": [ "GET", "POST" ]
        }
    ]
}

Advanced Sample goginx.json file

{
    "listen" : ":443",
    "certificate" : "cert.pem",
    "key" : "key.pem",
    "log" : "goginx.log",
    "whitelist": [
        "127.0.0.1",
        "192.168.1.0/24"
    ],
    "compression" : true,
    "upstreams" : {
        "httpbin" : [
            "https://httpbin.org"
        ]
    },
    "discovery" : true,
    "routes" : [
        {
            "path" : "/search",
            "forwardUrl" : "httpbin:/anything",
            "allowedMethods": [ "GET", "POST" ],
            "forwardIp": true,
            "appendPath": false,
            "customHeaders" : {
                "X-Custom-Header1" : "Custom-Header1-Value",
                "X-Custom-Header2" : "Custom-Header2-Value"
            },
            "secureHeaders" : true,
            "cors" : {
                "origin" : "*",
                "methods" : "GET, POST",
                "credentials": true,
                "maxAge": "86400",
                "allowedHeaders": "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization",
                "cacheControl": "no-cache",
                "vary": "Accept-Encoding"
            },
            "cache" : 60,
            "timeout" : 5000
        },
        {
            "path" : "/downloads",
            "forwardUrl" : "file://dist"
        }
    ]
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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