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

@ -81,7 +81,12 @@ func run(cfgPath string, log *slog.Logger) error {
p, _, err := pm.ForSession(ctx, sid)
return p, err
}}
srv := &server.Server{Agent: ag, Store: st, Token: cfg.AuthToken, AllowRegistration: cfg.RegistrationAllowed(), TokenTTL: time.Duration(cfg.TokenTTLHours) * time.Hour, AllowedOrigins: cfg.AllowedOrigins, Log: log, Providers: pm,
trusted, err := server.ParseCIDRs(cfg.TrustedProxies)
if err != nil {
log.Error("invalid trusted_proxies", "err", err)
os.Exit(1)
}
srv := &server.Server{TrustedProxies: trusted, Agent: ag, Store: st, Token: cfg.AuthToken, AllowRegistration: cfg.RegistrationAllowed(), TokenTTL: time.Duration(cfg.TokenTTLHours) * time.Hour, AllowedOrigins: cfg.AllowedOrigins, Log: log, Providers: pm,
Info: server.Info{Version: version, Provider: cfg.LLM.Provider, Model: cfg.LLM.Model, BaseURL: cfg.LLM.BaseURL},
RunTimeout: time.Duration(cfg.LLM.TimeoutSec*cfg.Agent.MaxIterations) * time.Second}