Update session cookie deletion to conditionally use secure flag based on HTTPS protocol

This commit is contained in:
Sean Morley
2024-12-29 12:55:45 -05:00
parent b5ac66a1cc
commit fd7f285c57
2 changed files with 4 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ export const actions: Actions = {
credentials: 'include'
});
if (res.status == 401) {
event.cookies.delete('sessionid', { path: '/', secure: event.url.protocol === 'https:' });
return redirect(302, '/login');
} else {
return redirect(302, '/');