From 57c3e9f1b2c1d685472670b8ba2660144d2ae316 Mon Sep 17 00:00:00 2001 From: Henri Vasserman Date: Fri, 28 Mar 2025 19:38:34 +0200 Subject: Change how to make Anubis work without a reverse proxy (#86) * Change how to make Anubis work without a reverse proxy * Apply suggestions from code review Co-authored-by: Xe Iaso Signed-off-by: Henri Vasserman * add support for unix sockets. * add env var docs * lib: fix tests Signed-off-by: Xe Iaso --------- Signed-off-by: Henri Vasserman Signed-off-by: Xe Iaso Co-authored-by: Xe Iaso --- cmd/anubis/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/anubis/main.go') diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go index 7f98e7b..b634676 100644 --- a/cmd/anubis/main.go +++ b/cmd/anubis/main.go @@ -45,7 +45,7 @@ var ( slogLevel = flag.String("slog-level", "INFO", "logging level (see https://pkg.go.dev/log/slog#hdr-Levels)") target = flag.String("target", "http://localhost:3923", "target to reverse proxy to") healthcheck = flag.Bool("healthcheck", false, "run a health check against Anubis") - debugXRealIPDefault = flag.String("debug-x-real-ip-default", "", "If set, replace empty X-Real-Ip headers with this value, useful only for debugging Anubis and running it locally") + useRemoteAddress = flag.Bool("use-remote-address", false, "read the client's IP address from the network request, useful for debugging and running Anubis on bare metal") ) func keyFromHex(value string) (ed25519.PrivateKey, error) { @@ -214,7 +214,7 @@ func main() { var h http.Handler h = s - h = internal.DefaultXRealIP(*debugXRealIPDefault, h) + h = internal.RemoteXRealIP(*useRemoteAddress, *bindNetwork, h) h = internal.XForwardedForToXRealIP(h) srv := http.Server{Handler: h} @@ -226,7 +226,7 @@ func main() { "serveRobotsTXT", *robotsTxt, "target", *target, "version", anubis.Version, - "debug-x-real-ip-default", *debugXRealIPDefault, + "use-remote-address", *useRemoteAddress, ) go func() { -- cgit v1.2.3