packages for a self-hosted http(s) (reverse?) multi-proxy

60 views
Skip to first unread message

Sebastien Binet

unread,
Jun 6, 2021, 4:28:15 AM6/6/21
to golang-nuts
hi,

I am trying to setup a little self-hosted http(s) server at home.
it should be able to serve the following:

- https://example.com/x/pkg1 [a 'go-get'-able Go pkg]
- https://example.com/x/pkg2 [ditto]
- https://example.com/mumble [a mumble server for family and friends]
- https://example.com/clown [a whole ownCloud server instance]
- https://example.com/upspin [a Upspin server instance]

ideally, the server behind 'example.com' would be my rpi-4, hosting a
single Go-based http(s) server that would redirect/route calls to
/mumble and /clown to the correct 3rd-party (resp.) Mumble and ownCloud
server (on the same rpi-4, at dedicated ports, say :8001 and :8002),
while handling the vanity imports locally.
(and with x/crypto/acme/autocert to handle certificates).

is that possible?
any pointers to tutorials and/or packages to do such a thing?

thanks,
-s

Sean Liao

unread,
Jun 6, 2021, 1:23:21 PM6/6/21
to golang-nuts
net/http/httputil.ReverseProxy should do it https://pkg.go.dev/net/http/httputil#ReverseProxy

I think it's easier if you set it up as a standard server and configure a SingleHostReverseProxy as a handler for each of the upstreams
Reply all
Reply to author
Forward
0 new messages