A simpler version of Nginx, BUT MORE.
- 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
- Install golang
- Install goreleaser
- Install make
go get
make build
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"
}
]
}