feat: 准备 Admin 线上 HTTPS 部署 (#81)
This commit is contained in:
@@ -202,7 +202,7 @@ func safeNext(raw string) string {
|
||||
func setAuthCookie(c *gin.Context, token string, expiresAt time.Time) {
|
||||
http.SetCookie(c.Writer, &http.Cookie{
|
||||
Name: authCookieName, Value: token, Path: "/", HttpOnly: true,
|
||||
Secure: c.Request.TLS != nil, SameSite: http.SameSiteLaxMode,
|
||||
Secure: requestIsHTTPS(c.Request), SameSite: http.SameSiteLaxMode,
|
||||
Expires: expiresAt, MaxAge: int(service.WebSessionDuration.Seconds()),
|
||||
})
|
||||
}
|
||||
@@ -210,7 +210,7 @@ func setAuthCookie(c *gin.Context, token string, expiresAt time.Time) {
|
||||
func clearAuthCookie(c *gin.Context) {
|
||||
http.SetCookie(c.Writer, &http.Cookie{
|
||||
Name: authCookieName, Value: "", Path: "/", HttpOnly: true,
|
||||
Secure: c.Request.TLS != nil, SameSite: http.SameSiteLaxMode,
|
||||
Secure: requestIsHTTPS(c.Request), SameSite: http.SameSiteLaxMode,
|
||||
Expires: time.Unix(1, 0), MaxAge: -1,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user