7

EDIT: I realized that I have been using https://www.sharethis.com/ in order to integrate share buttons into my website. For some reason, this causes a cookie to be added with no name. This messes with Chrome's ability to read the other cookies. I hope this information helps others in case you run into a strangely specific situation like this one!

I'm experiencing a weird error similar to the error in this post where upon redirect my flask app loses session cookies, and it only happens in Chrome.

However, the favicon is in the right location and the top answer is not the issue (there's no 404 when trying to load resources). Something interesting to note is that it seems that it only happens sometimes, and only on certain redirects. Another interesting thing is that once it happens, Chrome will no longer store any session variables until I quit it entirely and reopen it (or open an incognito window).

Here's my redirecting code:

session["msg"] = 1
return redirect("/active")

If I print the session immediately before the redirect, it's populated, but if I print it on the first line of the function at /active, it's completely empty. Chrome still has a session cookie (the cookie value has changed), but as I said I can no longer populate it at all until quitting the browser and reopening.

It works entirely fine on Safari, Edge, and Firefox.

I've spent at least a few weeks trying to figure this out and I'm really not sure where to go at this point.

Thank you!

0 Answers0