Believe X-Forwarded-* only from router.trusted_proxies
A new internal/clientip says who sent a request and how: the connection's address, scheme and Host, or through a configured proxy what it forwarded. The base URL in pages and setup scripts, isHTTPS for cookies, and the per-address limits of auth and the sign-in forms use it. /setup scripts are no-store. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
44cd58005a
commit
fe5b7f88f0
14 files changed
+231
-34
No files matched your search
@@ -16,6 +16,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/clientip"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/inventory"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/control/modelserve"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/gguf"
|
||||
@@ -361,6 +362,9 @@ func newServerCmd() *cobra.Command {
|
||||
if err := checkAdminListen(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if bad := clientip.SetTrusted(cfg.Router.TrustedProxies); len(bad) > 0 {
|
||||
return fmt.Errorf("router.trusted_proxies: %q is not an address or a CIDR prefix", bad[0])
|
||||
}
|
||||
adminToken, err := ensureAdminToken(adminTokenPath(configPath, cfg))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user