Please help me!. I wanna set domain for my cookie, In my main function, i set :
store := sessions.NewCookieStore([]byte("secretkey"))
store.Options(sessions.Options{
Domain: "myexample.com",
})
router.Use(sessions.Sessions("mysession", store))
In my first handler function, i set:
session := sessions.Default(c)
session.Set("test", "test value")
session.Save()
In another handler, i get the "test" session by:
session := sessions.Default(c)
result = session.Get("test")
But the problem is the value of result is nil, if i remove
store.Options(sessions.Options{
Domain: "myexample.com",
})
in main function, it will work. So anyone can explain for me. Moreover, if i get session "test" in my first handler function, it will be ok.