Rails4 ActionController::InvalidAuthenticityToken error

前端 未结 6 1527
无人及你
无人及你 2021-02-13 00:07

I have Rails4 application running in production, and my visitors run occasionally into ActionController::InvalidAuthenticityToken error, which I cant reproduce. I get 2-4 daily

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 00:25

    To answer my own question, in case someone runs into the same issue, it seems like removing csrf_meta_tag from the header fixed the problem for us. I dont know why. Could be that rails javascript responsible for setting the auth_token was interfering in some way with our javascript and caused the problem, but my gut feeling is that it had to so something with cache, either on server or client side. Anyway, after removing csrf_meta_tag it seems like we got rid of the problem. Just make sure you're using the form_tag for all your forms.

提交回复
热议问题