|
@@ -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() {
|