Redis session store ,Options not working
Opened this issue · 1 comments
Deleted user commented
`s := gin.New()
s.Use(gin.Recovery())
s.Use(gin.Logger())
store, _ := sessions.NewRedisStore(10, "tcp", "192.168.99.100:32775", "", []byte("secret"))
store.Options(sessions.Options{
MaxAge: 3600,
Path: "/",
Secure: true,
HttpOnly: true,
})
s.Use(sessions.Sessions("session", store))
s.GET("/home",controllers.Home)
`
controllers.Home
`
func Home(c *gin.Context) {
s := sessions.Default(c)
var count int
v := s.Get("count")
if v == nil {
count = 0
} else {
count = v.(int)
count += 1
}
s.Set("count", count)
s.Save()
c.JSON(200, gin.H{"count": count})
}`
/home return {"count":0} with no cookie
demonwang commented
yes it is not working