Fix cookie port error

This commit is contained in:
Daniel Ponte 2025-02-04 09:52:09 -05:00
parent f3e8f7afd9
commit 5329091236

View file

@ -211,7 +211,7 @@ func (a *Auth) routeRefresh(w http.ResponseWriter, r *http.Request) {
} }
if cookie.Secure { if cookie.Secure {
cookie.Domain = r.Host cookie.Domain = strings.Split(r.Host, ":")[0]
} }
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
@ -271,7 +271,7 @@ func (a *Auth) routeAuth(w http.ResponseWriter, r *http.Request) {
MaxAge: 60 * 60 * 24 * 30, // one month MaxAge: 60 * 60 * 24 * 30, // one month
} }
cookie.Domain = r.Host cookie.Domain = strings.Split(r.Host, ":")[0]
if a.allowInsecureCookie(r) { if a.allowInsecureCookie(r) {
a.setInsecureCookie(cookie) a.setInsecureCookie(cookie)
} }
@ -297,7 +297,7 @@ func (a *Auth) routeLogout(w http.ResponseWriter, r *http.Request) {
MaxAge: -1, MaxAge: -1,
} }
cookie.Domain = r.Host cookie.Domain = strings.Split(r.Host, ":")[0]
if a.allowInsecureCookie(r) { if a.allowInsecureCookie(r) {
cookie.Secure = true cookie.Secure = true
cookie.SameSite = http.SameSiteNoneMode cookie.SameSite = http.SameSiteNoneMode