Post/Redirect/Get:Get 被多次调用

发布于 2024-10-02 01:46:28 字数 299 浏览 0 评论 0原文

我有一个网页,其中有一个通过 POST 提交的表单。此 POST 路由处理一些数据并将用户重定向到 GET 路由。问题:GET 路由被调用多次,通常为 3 次。因此,三个 GET 被触发,用户看到的是第一个 GET 请求。我可以在日志中看到另外两个 GET 请求。

有时甚至会发生 GET 被调用超过 3 次的情况...

(当然 POST 路由只被调用一次...)

顺便说一句,我在 Jetty 上使用 JRuby/JRack/Sinatra (-> Google App)引擎。)问题发生在本地和远程。

菲利普

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

过期以后 2024-10-09 01:46:28

我之前的代码中也遇到过同样的问题(尽管平台不同)。事实证明,页面中的元素引用了与页面相同的 url。我有 1 个损坏的图像和 2 个被忽略的已设置到父页面的 css 文件。

如果是同类问题,可以使用Firebug的net选项卡来验证和调试。

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.

自在安然 2024-10-09 01:46:28

如果没有看到代码则不确定,但在大多数情况下,脚本将在调用重定向函数后继续执行。尝试在调用redirect_to后立即从您的方法返回。

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.

心碎的声音 2024-10-09 01:46:28

您的代码中存在逻辑错误。修复它。

There is a logical bug in your code. Fix it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文