iris icon indicating copy to clipboard operation
iris copied to clipboard

[BUG] ShiftExpiration writes "invalid Cookie.Domain" error to log when running behind UNIX socket

Open kastmgnru opened this issue 6 months ago • 0 comments

Describe the bug

When running an Iris application using a UNIX socket (e.g. /var/run/app.sock), invoking the sess.ShiftExpiration(ctx) function produces the following error in the logs, even though session and cookies otherwise work correctly:

net/http: invalid Cookie.Domain "/var/run/app.sock"; dropping domain attribute

To Reproduce

  1. Start Iris with a UNIX socket listener: l, _ := netutil.UNIX("/var/run/app.sock", 0666) app.Run(iris.Listener(l))

  2. Use session middleware, e.g.: sess := sessions.New(sessions.Config{ Cookie: "session_id", Expires: 24 * time.Hour, AllowReclaim: true, })

  3. In any handler, call: sess.ShiftExpiration(ctx)

Expected behavior No error should be written to logs; Iris should not attempt to use the UNIX socket path as a cookie domain.

Desktop (please complete the following information): Go version: 1.24.4 OS: Linux All requests go through nginx, with correct Host header forwarding.

iris.Version v12.2.11

Thank you!

kastmgnru avatar Jun 30 '25 14:06 kastmgnru