fix(join): use secure: !dev for JSESSIONID cookie to work in local dev

Hardcoded secure: true silently drops the cookie on HTTP (localhost),
causing the post-join redirect to bounce back to /login. Use $app/environment
dev flag so the cookie works in development while remaining Secure in production.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 22:25:48 +02:00
parent 0b182a33fd
commit 230ee5a067
2 changed files with 4 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import { fail, redirect } from '@sveltejs/kit';
import { dev } from '$app/environment';
import { apiClient } from '$lib/server/api';
import type { Actions, PageServerLoad } from './$types';
@@ -74,7 +75,7 @@ export const actions = {
path: '/',
httpOnly: true,
sameSite: 'lax',
secure: true
secure: !dev
});
}

View File

@@ -4,6 +4,8 @@ vi.mock('$env/dynamic/private', () => ({
env: { BACKEND_URL: 'http://localhost:8080' }
}));
vi.mock('$app/environment', () => ({ dev: false }));
const mockGet = vi.fn();
const mockPost = vi.fn();
vi.mock('$lib/server/api', () => ({