aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHenri Vasserman <henv@hot.ee>2025-03-28 19:38:34 +0200
committerGitHub <noreply@github.com>2025-03-28 13:38:34 -0400
commit57c3e9f1b2c1d685472670b8ba2660144d2ae316 (patch)
treeb3e31374ca5b41ce9e1e16ee2b13752cc1ac7018 /cmd
parente9a6ebffbb5cdd3d3f452610bda4371e51288058 (diff)
downloadanubis-57c3e9f1b2c1d685472670b8ba2660144d2ae316.tar.xz
anubis-57c3e9f1b2c1d685472670b8ba2660144d2ae316.zip
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 <me@xeiaso.net> Signed-off-by: Henri Vasserman <henv@hot.ee> * add support for unix sockets. * add env var docs * lib: fix tests Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Henri Vasserman <henv@hot.ee> Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/anubis/main.go6
1 files changed, 3 insertions, 3 deletions
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() {