Browse Source

Cookie for http only

Vova Tkach 6 years ago
parent
commit
23bd5526a7
1 changed files with 5 additions and 4 deletions
  1. 5 4
      engine/sessions/sessions.go

+ 5 - 4
engine/sessions/sessions.go

@@ -79,10 +79,11 @@ func (this *Session) Load() {
 		// Set session cookie
 		expiration := time.Now().Add(365 * 24 * time.Hour)
 		cookie := http.Cookie{
-			Name:    "fsession",
-			Value:   userhashstr,
-			Path:    "/",
-			Expires: expiration,
+			Name:     "fsession",
+			Value:    userhashstr,
+			Path:     "/",
+			Expires:  expiration,
+			HttpOnly: true,
 		}
 		http.SetCookie(*this.W, &cookie)
 	}