You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: CapacitorCookies does not respect subsequent response Set-Cookie headers on iOS #7968
After enabling CapacitorCookies, I'm observing this faulty behaviour with cookie handling on iOS devices:
When the response first returns a Set-Cookie header, it is persisted correctly (verified that it shows up under Safari Storage > Cookies when inspected).
Subsequent server responses returning a Set-Cookiefor the same cookie, are ignored and the persisted cookie doesn't update. This results in the old stale cookie being sent back to the server on subsequent requests.
Some of the scenarios this issue blocks:
Server simply wanting to clear a cookie (e.g. common on logging out). Currently the cookie persists.
If the user signs in with another account it keeps sending the previous user's cookie.
Server wanting to update the cookie as a result of updated claims etc., or simply updating the expiry date.
Other notes:
This doesn't happen on an Android device based on my testing, so seems to be a bug just on the iOS implementation.
This behaviour doesn't happen with the normal "unpatched" document.cookie (i.e. when not having CapacitorCookies enabled)
When I manually delete the cookie, then the subsequent responses with Set-Cookie are properly processed. This leads me to believe there is a bug in the iOS implementation somewhere that cannot handle an existing cookie.
Expected Behavior
Every Set-Cookie header should be processed, and update existing cookie if one exists.
Project Reproduction
Can provide later if absolutely necessary, but the explanation is clear.
We also have been seeing this issue for quite some time and have had to work around it in a not ideal way that we would eventually like to remove. I opened #6591 a few years ago which appears to be the same root cause as this new opened issue
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Activity
SaebAmini commentedon Apr 9, 2025
Reading #7262, I think the issues could be because of the same root cause.
davidbeaton commentedon Apr 16, 2025
We also have been seeing this issue for quite some time and have had to work around it in a not ideal way that we would eventually like to remove. I opened #6591 a few years ago which appears to be the same root cause as this new opened issue
#6591
eric-horodyski commentedon Feb 24, 2026
We’re reviewing older issues as part of our backlog cleanup effort:
https://ionic.io/blog/keeping-capacitors-backlog-healthy
To keep this open, please provide an updated minimal reproduction and environment details on the latest version of Capacitor within 7 days.
Otherwise, we’ll close it to keep the backlog focused. It can always be reopened with updated info.
Ionitron commentedon Sep 9, 2026
It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.
Have a great day!
Ionitron 💙
ionitron-bot commentedon Oct 9, 2026
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.