Jelajahi Sumber

fix: adjust backend server configuration

Adam 4 bulan lalu
induk
melakukan
5210b7320c
1 mengubah file dengan 6 tambahan dan 6 penghapusan
  1. 6 6
      backend/server.js

+ 6 - 6
backend/server.js

@@ -36,7 +36,7 @@ const INDEX_FILE = path.join(POSTS_DIR, 'index.json');
 
 // Middleware
 app.use(cors({
-  origin: process.env.FRONTEND_URL || 'http://localhost:5173', // Frontend URL
+  origin: ['http://localhost:5173', 'https://goonblog.thevakhovske.eu.org'],
   credentials: true // Enable cookies
 }));
 app.use(express.json());
@@ -57,11 +57,11 @@ app.use(session({
   saveUninitialized: false,
   name: 'gooneral-session',
   cookie: {
-    secure: process.env.COOKIE_SECURE === 'true' || process.env.NODE_ENV === 'production',
-    httpOnly: true,
-    maxAge: 24 * 60 * 60 * 1000, // 24 hours
-    sameSite: process.env.COOKIE_SAME_SITE || (process.env.NODE_ENV === 'production' ? 'strict' : 'lax')
-  }
+  secure: true,  // HTTPS required
+  httpOnly: true,
+  maxAge: 24 * 60 * 60 * 1000, // 24 hours
+  sameSite: 'lax'  // Changed from 'strict' to 'lax'
+}
 }));
 
 // Ensure posts directory exists