Skip to content

Commit

Permalink
Revert "Set-Cookie use __Host-"
Browse files Browse the repository at this point in the history
This reverts commit 531db88.
  • Loading branch information
lifegpc committed Jun 3, 2024
1 parent 68182ae commit 1e88cfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions routes/api/_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,9 @@ export async function handler(req: Request, ctx: FreshContext) {
if (ot.expired.getTime() - 2505600000 < now) {
try {
const t = m.db.update_token(ot.token, now);
const host = t.secure ? "__Host-" : "";
headers.append(
"Set-Cookie",
`${host}token=${t.token}; Expires=${t.expired.toUTCString()}${
`token=${t.token}; Expires=${t.expired.toUTCString()}${
t.http_only ? "; HttpOnly" : ""
}${
t.secure
Expand Down
6 changes: 2 additions & 4 deletions routes/api/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export const handler: Handlers = {
m.db.delete_token(t);
const headers: HeadersInit = {};
if (is_from_auth && is_from_cookie) {
const host = token.secure ? "__Host-" : "";
headers["Set-Cookie"] = `${host}token=${token.token}; Max-Age=0${
headers["Set-Cookie"] = `token=${token.token}; Max-Age=0${
token.http_only ? "; HttpOnly" : ""
}${
token.secure
Expand Down Expand Up @@ -153,9 +152,8 @@ export const handler: Handlers = {
);
const headers: HeadersInit = {};
if (set_cookie) {
const host = token.secure ? "__Host-" : "";
headers["Set-Cookie"] =
`${host}token=${token.token}; Expires=${token.expired.toUTCString()}${
`token=${token.token}; Expires=${token.expired.toUTCString()}${
http_only ? "; HttpOnly" : ""
}${
secure
Expand Down

0 comments on commit 1e88cfe

Please sign in to comment.