Browse Source

feat: configure session store options for API routes

- Set session cookie path to "/api"
- Disable secure flag for local development
- Enable HttpOnly flag for improved security
[email protected] 11 months ago
parent
commit
6acc37cf27
1 changed files with 5 additions and 0 deletions
  1. 5 0
      main.go

+ 5 - 0
main.go

@@ -145,6 +145,11 @@ func main() {
 	middleware.SetUpLogger(server)
 	// Initialize session store
 	store := cookie.NewStore([]byte(common.SessionSecret))
+	store.Options(sessions.Options{
+		Path:     "/api",
+		Secure:   false,
+		HttpOnly: true,
+	})
 	server.Use(sessions.Sessions("session", store))
 
 	router.SetRouter(server, buildFS, indexPage)