---
title: "Hacking Around Safari's 7-day Cookie Limit"
description: "Safari's Intelligent Tracking Prevention deletes client-side cookies after 7 days, so users in GDPR/CCPA regions get the cookie consent banner again every week."
url: "https://swe.quest/articles/hacking-around-safari-s-7-day-cookie-limit-511d20c71ebc9e5a"
canonical: "https://artsy.github.io/blog/2022/08/23/getting-around-7-day-cookie/"
source: "Artsy Engineering"
published: "2022-08-23"
difficulty: "medium"
kind: "How-to"
reading_minutes: 2
tags: ["browsers","privacy","frontend","javascript"]
---

# Hacking Around Safari's 7-day Cookie Limit

A post on [Artsy Engineering](https://swe.quest/sources/artsy.md), published 2022-08-23, 2 min read, How-to. Original: [https://artsy.github.io/blog/2022/08/23/getting-around-7-day-cookie/](https://artsy.github.io/blog/2022/08/23/getting-around-7-day-cookie/)

## Summary

Safari's Intelligent Tracking Prevention deletes client-side cookies after 7 days, so users in GDPR/CCPA regions get the cookie consent banner again every week. Artsy works around this by having the client send its consent cookie value to a same-domain Express endpoint, which re-sets a cookie with the same name as a secure server-side cookie with a long maxAge. Safari then keeps the preference past the 7-day limit. The fix is a few lines of code, prompted by a WebKit engineer's note that same-domain secure server-set cookies are exempt from the limit, though the post admits the exact mechanism is not fully understood.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Privacy](https://swe.quest/tags/privacy.md) (Security)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)

## Prerequisites

- HTTP cookies
- Express.js basics

## Keywords

Safari, Intelligent Tracking Prevention, WebKit, GDPR, CCPA, Express, cookies-js

## Related posts

- [Link Click Analytics and Privacy](https://swe.quest/articles/link-click-analytics-and-privacy-ebc2604ab6e0de6c.md): WebKit · 2019-04-11 · Medium · 5 min read · Privacy, Browsers, Web performance
  WebKit keeps the anchor Ping attribute and the Beacon API enabled.
- [Private Browsing 2.0](https://swe.quest/articles/private-browsing-2-0-e10509f44e8abcba.md): WebKit · 2024-07-16 · Medium · 19 min read · Privacy, Browsers, Security
  Safari 17.0–17.5 extends Private Browsing well beyond ephemeral storage, adding link tracking protection that strips known click-level tracking query parameters before navigation and hides URL query strings, fragments and cross-site referrers from third-party scripts.
- [Testing cookie behavior across hundreds of web surfaces with our in-house auditor](https://swe.quest/articles/testing-cookie-behavior-across-hundreds-of-web-surfaces-with-our-in-house-474b16dbccccd373.md): Dropbox Tech · 2026-08-31 · Medium · 9 min read · Privacy, Testing, Browsers
  Dropbox built an automated cookie auditor that uses Playwright to visit its 200+ web surfaces as a fresh, privacy-conscious visitor, running separate US, EU and Global Privacy Control scenarios that record cookies before interaction, decline non-essential cookies via the underlying consent controls (across 22 languages), reload, and verify the preference persists.
- [Incident Report: March 30th, 2026 — Authenticated user data cached](https://swe.quest/articles/incident-report-march-30th-2026-authenticated-user-data-cached-6873088e4b983942.md): Railway · 2026-03-30 · Easy · 2 min read · Incidents & postmortems, Caching, CDN & edge, Privacy, Deployment
  A CDN configuration change meant to enable Surrogate Keys for per-domain caching accidentally turned on edge caching for about 0.05% of Railway domains that had CDN disabled.
- [New WebKit Features in Safari 15.4](https://swe.quest/articles/new-webkit-features-in-safari-15-4-378317c134d40474.md): WebKit · 2022-03-14 · Medium · 13 min read · Browsers, CSS, Frontend, JavaScript
  Safari 15.4 ships over 70 WebKit additions, led by the \<dialog\> element with ::backdrop, lazy-loaded images, the :has() parent selector (shipped first in Safari), Cascade Layers, CSS containment, and new small/large/dynamic viewport units (svh, lvh, dvh and friends) that fix mobile viewport sizing.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
