Go to Home

Session persisting issue on Safari for cross domain

While working on my office project with MERN stack, I stumbled upon a issue where my sessions from react app isn't persisting with my express backend app. And this happened only on safari browser and not on other browsers. The reason behind this is, safari by default disables session handling for cross domains. That is, assume your frontend app is running on example.com and your backend is being served from backend.com, then safari would not persist the sessions. Inorder to disable this feature, do the following.

Safari > Preference > Privacy > uncheck the "Prevent cross-site tracking".

safari-privacy.png

After performing the above action, your sessions will work like all other browsers.

Happy Coding!

One email per week. No spam ever.

Subscribe