Trust no proxies on the local server

antidriftd binds localhost only and sits behind no proxy, so trusting all
proxies (gin's default) is both wrong and a startup warning. Set an empty
trusted-proxy list to disable forwarded-IP header trust and silence it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 19:24:19 -04:00
parent 71b8c80c69
commit 4f6b26a220
+3
View File
@@ -40,6 +40,9 @@ func NewServer(ctrl *session.Controller) *Server {
func (s *Server) Router() *gin.Engine { func (s *Server) Router() *gin.Engine {
r := gin.New() r := gin.New()
r.Use(gin.Recovery()) r.Use(gin.Recovery())
// antidriftd binds localhost only and sits behind no proxy, so trust no
// forwarded-IP headers. This also silences gin's trust-all-proxies warning.
_ = r.SetTrustedProxies(nil)
sub, _ := fs.Sub(staticFS, "static") sub, _ := fs.Sub(staticFS, "static")
r.GET("/", func(c *gin.Context) { r.GET("/", func(c *gin.Context) {