https reverse proxy with automatic Letsencrypt usage for multiple hostnames/backends, and path URL rewriting
Go to file
mleku aa1c1aa96c added some extra common fields
content-length and strict-transport-security

not sure if they matter but whatever

hell, i'd put a "content-hash" field in there if that actually did anything
2024-04-21 22:08:47 +01:00
buf breaking the things into bits 2023-11-28 10:46:32 +00:00
hsts switching over to github.com/alexflint/go-arg 2024-02-25 18:55:00 +00:00
reverse update readme and go mod 2024-04-21 20:46:03 +01:00
tcpkeepalive update readme and go mod 2024-04-21 20:46:03 +01:00
timeout switching over to github.com/alexflint/go-arg 2024-02-25 18:55:00 +00:00
util breaking the things into bits 2023-11-28 10:46:32 +00:00
.gitignore switching over to github.com/alexflint/go-arg 2024-02-25 18:55:00 +00:00
LICENSE.txt Initial commit 2016-04-20 15:53:40 +03:00
README.md add nostr.json example 2024-04-21 20:47:04 +01:00
go.mod update readme and go mod 2024-04-21 20:43:14 +01:00
go.sum update readme and go mod 2024-04-21 20:46:03 +01:00
main.go added some extra common fields 2024-04-21 22:08:47 +01:00

README.md

lerproxy

Command lerproxy implements https reverse proxy with automatic LetsEncrypt usage for multiple hostnames/backends including a static filesystem directory, nostr NIP-05 hosting and URL rewriting (TODO).

Install:

go install mleku.com/git/lerproxy@latest

Run:

lerproxy -addr :https -map /path/to/mapping.txt -cacheDir /path/to/letsencrypt

mapping.txt contains host-to-backend mapping, where backend can be specified as:

  • http/https url for http(s) connections to backend without passing "Host" header from request;
  • host:port for http over TCP connections to backend;
  • absolute path for http over unix socket connections;
  • @name for http over abstract unix socket connections (linux only);
  • absolute path with a trailing slash to serve files from a given directory.

Example:

nostr.example.com: /path/to/nostr.json
subdomain1.example.com: 127.0.0.1:8080
subdomain2.example.com: /var/run/http.socket
subdomain3.example.com: @abstractUnixSocket
uploads.example.com: https://uploads-bucket.s3.amazonaws.com
# this is a comment, it can only start on a new line
static.example.com: /var/www/

Note that when @name backend is specified, connection to abstract unix socket is made in a manner compatible with some other implementations like uWSGI, that calculate addrlen including trailing zero byte despite documentation not requiring that. It won't work with other implementations that calculate addrlen differently (i.e. by taking into account only strlen(addr) like Go, or even UNIX_PATH_MAX).