Mark Ku's Blog

Background

Because of GDPR regulations, major browsers have been restricting third-party sites from writing cookies in order to prevent ad tracking on users. Our product is often embedded by customers (via iframe) inside their own websites, so we ran into this restriction.

Problems We've Hit

  1. After a Windows update, IIS changed the default cookie mode from strict to Lax. (The product team later used URL Rewrite to override the response header value based on different user agents.)

  2. After one Safari update, third-party sites were blocked from writing cookies. (After validating feasibility through a PoC, we discussed it with the product department and ended up adopting Apple's Storage Access API.)

Solutions

Short-term

  1. Redirect the page to the product vendor's site.
  2. Adopt Apple's Storage Access API. Platform side: the iframe sandbox needs allow-same-origin and allow-storage-access-by-user-activation. Product side: the page that sets the cookie needs a button so the user can confirm and trigger the Storage Access API.

Mid- to long-term (product side)

  1. Switch to token-based authentication (the product side stops using cookies).
  2. Remove sticky cookies (need to think about how logs will be tracked afterwards).
  3. Remove cookie data.

Notes

  1. The SameSite bug on iOS 13 On versions before iPhone 13 there was a bug where any value set on SameSite was treated as Lax. You can't set SameSite=none, so you have to set SameSite="".
  2. Storage Access API support The new Edge and Chrome already support the Storage Access API and it's currently in beta. It's likely more browsers will follow in the future.

Author

Mark Ku

擁有 10+ 年經驗的資深軟體工程師,現為 AI 應用 Builder,專注於大型平台架構與簡化複雜系統設計,從電商系統到訂閱與收費平台,結合 AI Agent、AI 整合與自動化開發,打造高效率且可持續演進的產品技術基礎。Read More

Found this useful?

The author's free tools, daily podcasts and newsletter are all here.

Mark Ku · This article is licensed under CC BY 4.0. Credit the author and link back to the original when reusing it.

Comments

Subscribe to Newsletter

Subscribe to get new posts delivered instantly — never miss a tech share.

By submitting, you agree to receive emails. You can anytime.

Popular Posts

View all
Mark Ku
··602

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution

Oracle Cloud Always Free Tier: Linux Host and Static IP for a $0 Cloud Solution
Mark Ku
··490

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.

Say Goodbye to Postman's Fee Trap! A Hands-on Guide to Bruno, the Open-Source Git-Native API Testing Powerhouse.
Mark Ku
··333

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki

A Free, Open-Source, Notion-like Knowledge Base — A Complete Guide to Deploying and Backing Up Outline Wiki
Mark Ku
··264

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning

Training Your Own AI Voice: Hardware Requirements, Open-Source Model Comparison, and LoRA Fine-Tuning
Mark Ku
··221

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1

Building an Efficient API Management Platform: Deploying Kong Gateway from Scratch - Part 1
Mark Ku
··215

Setting Up Samba on Ubuntu to Share Folders with Windows 11

Setting Up Samba on Ubuntu to Share Folders with Windows 11
SameSite Issue - Mark Ku's Tech Notes