Safari 11 X-XSRF-TOKEN not updated after refresh

我是研究僧i 提交于 2019-12-21 04:41:05

问题


Recently Safari 11 was released on Mac OSX. This update causes problem with our webapplication in combination with XSRF on the header of our reuest. I will try to describe the problem in a logic way. This is how a good situation would look like:

  1. When a user wants to log in, he receives a response from the server with a Set-Cookie that contains the value of the XSRF token. Eg: Set-Cookie: XSRF-TOKEN=LKNBX4DZhL708KjXNkgXnlxTDCNuhsZG1kTc2SFy498; Path=/; Secure

  2. The page refreshes The next call that will be executed contains that correct XSRF value in the header. On the server side the value is checked etc. Each call from the front end will contain that XSRF token.

  3. If the user logs out and wants to log in again, his XSRF cookie will be overridden by a new value and is able to login with that token.

Our problematic situation (with Safari 11 on Mac OSX, other browser don’t show this behavior):

  1. If there are no cookies existing, the user can log in normal

  2. However, if he wants to log back in (after a previous session), the refresh takes places. On the first call other the refresh the XSRF-token on his call are not replaced by the new value, they still contain the old XSRF-token from the previous session. When we inspect this request we see that the cookies on this request are containing the right value, but the header is reflecting the old token.

  3. This call with the wrong header causes a session close in the backend and so the user is kicked out of his session. TLDR; in Safari 11 the header XSRF-TOKEN does not update accordingly to the cookie value after a refresh. We have this working on older versions and on other browsers, which we think is a Safar 11 bug.

Is anyone else experiencing a similar kind of issue? Where an header value of an request is not updated after a page refresh in Safari 11?

EDIT: After testing we have discoverd that placing a timestamp in the URL as query parameter forces Safari 11 to send the correct request. It seems that some requests are cached and updated headers are ignored..

Thanks a lot!


回答1:


I cannot really comment on your token issue but I do also have the suspicion that Safari 11 has a problem with caching. Lately, even for JSON requests that specify

Cache-Control: no-cache, private

Safari starts to cache those requests (shown as Cache (Disk)) after 2 reloads of the page from localhost. Neither firefox nor chrome do some. Looks like a bug to me?



来源:https://stackoverflow.com/questions/46525065/safari-11-x-xsrf-token-not-updated-after-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!