feat: add proxy protocol support (#394)

This can be useful when the pages-server is running behing a proxy, to
keep track of the originating ip.

Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/394
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Julien Malka <julien@malka.sh>
Co-committed-by: Julien Malka <julien@malka.sh>
This commit is contained in:
Julien Malka 2024-10-29 17:56:00 +00:00 committed by Gusted
parent 168bc9047b
commit bb7cfbb37c
6 changed files with 29 additions and 3 deletions

View file

@ -69,6 +69,10 @@ func mergeServerConfig(ctx *cli.Context, config *ServerConfig) {
if ctx.IsSet("enable-http-server") {
config.HttpServerEnabled = ctx.Bool("enable-http-server")
}
if ctx.IsSet("use-proxy-protocol") {
config.UseProxyProtocol = ctx.Bool("use-proxy-protocol")
}
if ctx.IsSet("pages-domain") {
config.MainDomain = ctx.String("pages-domain")
}