root: add support for PROXY protocol on listeners

closes #1161

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-07-20 11:03:09 +02:00
parent 49d0ccd9c7
commit d678d33756
6 changed files with 42 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"github.com/pires/go-proxyproto"
log "github.com/sirupsen/logrus"
"goauthentik.io/internal/config"
)
@ -63,7 +64,10 @@ func (ws *WebServer) listenPlain() {
}
ws.log.WithField("addr", config.G.Web.Listen).Info("Running")
ws.serve(ln)
proxyListener := &proxyproto.Listener{Listener: ln}
defer proxyListener.Close()
ws.serve(proxyListener)
ws.log.WithField("addr", config.G.Web.Listen).Info("Running")
err = http.ListenAndServe(config.G.Web.Listen, ws.m)