session icon indicating copy to clipboard operation
session copied to clipboard

func (m *Manager) Destroy(ctx context.Conetxt,.....) doesn' work.

Open qkrgksqkr opened this issue 2 years ago • 0 comments

I set session with init manager setting domain option. it is sub domain.

manager := session.NewManager(
	session.SetCookieName(...),
	session.SetCookieLifeTime(...),
	session.SetExpired(int64(...)),
	session.SetStore(...),
	session.SetSessionID(...),
	session.SetDomain(*.testdomain.com),
)

And, When I destroy session call function 'Destroy(..)' It dosen't work. It still exists that cookie however in server side , that cookie (= session) is removed.

Maybe I think it beacuase of this below logic

// Destroy a session func (m *Manager) Destroy(ctx context.Context, w http.ResponseWriter, r *http.Request) error { ......

**if m.opts.enableSetCookie {
	cookie := &http.Cookie{
		Name:     m.opts.cookieName,
		Path:     "/",
		HttpOnly: true,
		Expires:  time.Now(),
		MaxAge:   -1,
	}**

......

I think, It need to append 'Domain: m.opts.cookieName,'

please check this issue.

thank you.

qkrgksqkr avatar Jun 16 '23 03:06 qkrgksqkr