diff --git a/src/common.js b/src/common.js index ac2f568..4f537fc 100644 --- a/src/common.js +++ b/src/common.js @@ -285,7 +285,7 @@ export function doesCookieNeedRefresh(ctx) { * @return {boolean} */ export function possiblySetCookie(ctx, query) { - if (ctx.status >= 400 || (ctx.method === 'GET' && ctx.request.querystring.length === 0)) { + if (ctx.status >= 301) { return false; } return setHebcalCookie(ctx, query); diff --git a/src/shabbat.js b/src/shabbat.js index 6f3be40..cb55af2 100644 --- a/src/shabbat.js +++ b/src/shabbat.js @@ -93,7 +93,8 @@ export async function shabbatApp(ctx) { if (ctx.request.querystring.length === 0 && cookie && cookie.length) { // private cache only if we're tailoring results by cookie ctx.set('Cache-Control', 'private'); - } else { + } + if (q.set !== 'off') { possiblySetCookie(ctx, q); } if (q.amp === '1') {