Rails + Heroku, short PATCH requests randomly not work — why?

There is a simple admin panel for RoR and is hosted on Heroku, consisting mainly of tables of entities, and simple CRUD operations, most of which are implemented through AJAX. There are switch buttons for Boolean fields, PATCH requests in style /foo/4/toggle_bar, the answer is not required, the data in the query is also no more. So these queries on some systems/browsers give ERR_EMPTY_RESPONSE. After much dancing has changed the method to POST, and forgot, as it was necessary to use the system now, but the nature of the bug was never found.

In the end, the question - is it still impossible to fully use PATCH requests, or am I doing something wrong?

Some things that put me into a stupor:
- caught mainly in Windows/Chrome with the error above, including fresh chrome. Including, if memory serves, the new Opera
even caught one on a fresh FF, there is generally a mystery: after the page is loaded the first two queries are, the rest can't, without explanation
- on other machines with Windows, Linux, Chrome, Chromium, FF works. Logic version not found
- on the same page is a full AJAX form with a PATCH request, and it also works
September 19th 19 at 13:21
1 answer
September 19th 19 at 13:23
Perhaps if the account is free, heroku gives slow response and the connection falls off on timeout and the appropriate browser nepoluchaetsya no response.
It is necessary to look in the logs each request, prigodin whether it is a server, like heroku, you can enable logging and it will throw all the logs on the console.
how then to explain the difference between browsers? their settings? - corine76 commented on September 19th 19 at 13:26
The difference can clearly be seen or chaotic? - Felix_Hop commented on September 19th 19 at 13:29
: clearly. Got a couple of Chrome which did not work at all in any way, the rest was stable. However there was one FF where it worked the first 2 request, and is not, and as far as I remember, even without a message in the console. After reloading the page again repeated. - corine76 commented on September 19th 19 at 13:32
I think an error somewhere in your JS code. Just a hunch. - Felix_Hop commented on September 19th 19 at 13:35
: crossbrowser a rather strange error. Besides, if you change it to POST it worked. - corine76 commented on September 19th 19 at 13:38
It is likely. By the way, in rails, you can replace the PATCH on POST + _method: 'PATCH'. Proof: https://github.com/rack/rack/blob/master/lib/rack/... - Felix_Hop commented on September 19th 19 at 13:41
: such as they themselves should do. Do for the form, and to link with remote: true - there is no reason, and I have just such a case was. - corine76 commented on September 19th 19 at 13:44

Find more questions by tags Computer networksRubyRuby on RailsAJAXJavaScript