Use 'localhost' as a fallback for hostname
| @@ -458,7 +458,8 @@ export function getPasswordSalt() { | ||
| 458 | 458 | */ |
| 459 | 459 | export function getCookieSessionName() { |
| 460 | 460 | // Get server hostname and hash it to generate a session suffix |
| 461 | - const suffix = crypto.createHash('sha256').update(os.hostname()).digest('hex').slice(0, 8); | |
| 461 | + const hostname = os.hostname() || 'localhost'; | |
| 462 | + const suffix = crypto.createHash('sha256').update(hostname).digest('hex').slice(0, 8); | |
| 462 | 463 | return `session-${suffix}`; |
| 463 | 464 | } |
| 464 | 465 | |