Adrien Denat commited on
Commit
eb6d216
1 Parent(s): 837d314

only set cookie as secure in production as it breaks Safari in development (#87)

Browse files
Files changed (1) hide show
  1. src/hooks.server.ts +2 -1
src/hooks.server.ts CHANGED
@@ -1,3 +1,4 @@
 
1
  import { COOKIE_NAME } from "$env/static/private";
2
  import type { Handle } from "@sveltejs/kit";
3
  import { addYears } from "date-fns";
@@ -11,7 +12,7 @@ export const handle: Handle = async ({ event, resolve }) => {
11
  event.cookies.set(COOKIE_NAME, event.locals.sessionId, {
12
  path: "/",
13
  sameSite: "lax",
14
- secure: true,
15
  httpOnly: true,
16
  expires: addYears(new Date(), 1),
17
  });
 
1
+ import { dev } from "$app/environment";
2
  import { COOKIE_NAME } from "$env/static/private";
3
  import type { Handle } from "@sveltejs/kit";
4
  import { addYears } from "date-fns";
 
12
  event.cookies.set(COOKIE_NAME, event.locals.sessionId, {
13
  path: "/",
14
  sameSite: "lax",
15
+ secure: !dev,
16
  httpOnly: true,
17
  expires: addYears(new Date(), 1),
18
  });