1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mobile safariで意図しないCSRFトークンエラーがでる

Posted at

再現環境

Rails5
Mobile safari

再現動作

  1. ログイン中にホームボタンを押してホームに戻って一度safariのアプリを落とす。
  2. safariを再度起動して、CSRFトークンの検証をする何かしらのフォームからデータ送信。

対応策

application.rb
config.action_dispatch.default_headers.merge!('Cache-Control' => 'no-store, no-cache')

ブラウザのキャッシュを拒否するように設定する。
もう少し良い対応策があればいいんですが。。。

参考

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?