server: trusted_proxies – X-Forwarded-For für Rate-Limit hinter Reverse-Proxy

This commit is contained in:
OpenClaw Dev 2026-11-01 04:09:09 +01:00
parent 97646da970
commit 126f4be2b9
6 changed files with 101 additions and 7 deletions

View file

@ -3,9 +3,10 @@ package server
import (
"context"
"encoding/json"
"encoding/json"
"errors"
"log/slog"
"net"
"net/http"
"net/url"
"strings"
@ -38,6 +39,8 @@ type Server struct {
AllowRegistration bool
// TokenTTL is the lifetime of user tokens (default 30 days).
TokenTTL time.Duration
// TrustedProxies whose X-Forwarded-For is honoured (empty = loopback only).
TrustedProxies []*net.IPNet
authOnce sync.Once
limiter *limiter