balki February 2016

Random GET requests for POST URLs

In a rails app, I see crashes frequently (airbrakes) like below

AbstractController::ActionNotFound:The action '6826' could not be found for MembersController

Investigating further, the URL is configured to receive only PUT or POST requests but instead receives GET. Doesn't seem to be action of bots or a smart user. Do browsers sometime send both GET and POST requests when a link is clicked, should it be handled in the server and redirected to corresponding pages?

Answers


Bart Jedrocha February 2016

A browser will only send a GET request when a link is clicked - unless there is JavaScript telling it otherwise. Your app should handle POST and PUT requests for data submission, GET requests for data retrieval, and DELETE requests for data transmission. There could be several different causes of that error, it could be because you are representing a POST or PUT route using a link or your users are typing the url into the address bar.

Post Status

Asked in February 2016
Viewed 1,125 times
Voted 14
Answered 1 times

Search




Leave an answer