Rails InvalidAuthenticityToken at random moments

Here is the deal.

Our application works and is used by writers to submit content for a website. The problem is that from time to time, our authors receive an error message after submitting a form for any resource on the site. An error checking the production logs was an old old InvalidAuthenticityToken.

The problem is that they do not change the token, they do not cancel the form, they do nothing but write in the editor and click the submit button!

The error seems completely random, sometimes it happens, sometimes it’s not: / All I know is that it happens when editing or creating an element, so either POST or PUT requests, but the problem is that it is not one specific area of ​​the application, it just end up happening from time to time in all our forms.

Our environment is HAProxy serving mongrel_cluster with 20 mongrels running our application. Rails Version - 2.3.8

Could this be a problem with sessions in different mogrels? If not, then what can I do to stop random errors, due to which authors sometimes lose a lot of time editing text and simply lose it because of a damned error.

Any help is really appreciated.

+3
1

, .

900 , , , - -.

- , , ​​, , InvalidAuthenticityToken .

+3

Source: https://habr.com/ru/post/1758372/


All Articles