Hi I am having an issue in my current project, often we are receiving an error, Current application is running on Rails2.3.5 and Ruby 1.8.7
(ActionController::MethodNotAllowed) "Only getrequests are allowed."
For that I have found few options like
- prevent the error blocking non GET/POST/HEAD requests using your webserver
- prevent the error filtering the request via Rack Middleware
So would like to know how to prevent it via Rack Middleware.
Please some one suggest/assist me to get rid of this problem.
TIA.
You would need to create custom middleware and insert it before or after as per the requirement in application.rb.
I would need to handle json parse error in one of the projects and I have created the middle ware as below:
And added below line in application.rb file :