Post/Redirect/Get: Get is called multiple times
I have a webpage which has a form that is submitted via POST. This POST-route processes some data and redirects the User to a GET route. The problem: The GET route is called multiple times, usually 3 times. So three GET's are fired and the user see's the first GET request. The other two GET requests I can just see on my logs.
Occasionally it even happens that the GET is called more than three times...
(Of course the POST route is just called once...)
By the way I'm using JRuby/JRack/Sinatra on Jetty (-> Google App 开发者_如何学编程Engine.) The problem happens locally and remotely.
Philip
I have had that same issue in my code before (although different platform). It turned out to be elements in the page referencing the same url as the page. I had 1 broken image and 2 ignored css files that had been set to the parent page.
If it's the same kind of issue you can use Firebug's net tab to verify and debug.
Not sure without seeing the code, but in most cases a script will continue to execute after a call to a redirect function. Try returning from your method immediately after calling redirect_to.
There is a logical bug in your code. Fix it.
精彩评论