gin-contrib / sessions

Gin middleware for session management
MIT License
1.41k stars 192 forks source link

Setting MaxAge: 0 will cause the expires_at field stored in the store to be the current time, causing the session to expire. #265

Open GavinTan opened 2 months ago

GavinTan commented 2 months ago

I need to set the browser cookie expiration based on the session. Session.Options(sessions.Options{MaxAge:0}) can be implemented, but it directly causes the stored session to expire and the client cannot request normally. I have tried setting store.Options(sessions.Options{MaxAge:60}) If the session.Options(sessions.Options{MaxAge:0}) is set later, it will be directly overwritten.