Rails 升级 2.3.5 后给出错误的标头 -> 2.3.8
我刚刚从 Rails 2.3.5 升级到 Rails 2.3.8,但现在我的重定向无法正常工作。
我得到以下响应 HTTP 标头:
HTTP/1.1 302 Moved Temporarily
Date: Wed, 02 Jun 2010 09:40:39 GMT
Content-Length: 93
Content-Type: text/html
而我得到之前的:
HTTP/1.1 302 Moved Temporarily
Connection: close
Date: Wed, 02 Jun 2010 09:41:18 GMT
Set-Cookie: _session_id=<correct id>; path=/
Status: 302 Found
Location: <correct url>
Cache-Control: no-cache
Server: Mongrel 1.1.5
Content-Type: text/html; charset=utf-8
Content-Length: 93
任何人都知道如何解决此问题?尽管重定向不起作用,但登录cookie也没有设置(但我认为,这两者在某种程度上是相关的)。
我已经尝试覆盖redirect_to以设置response.headers['Location']等,但它们没有出现在响应中。
编辑:好吧,这似乎是 mongrel_rails 和 Rails 2.3.8 的一个错误,脚本/服务器没有这个问题。
I just upgraded from rails 2.3.5 to rails 2.3.8, but now my redirects are not working properly.
I get the following as the response HTTP Headers:
HTTP/1.1 302 Moved Temporarily
Date: Wed, 02 Jun 2010 09:40:39 GMT
Content-Length: 93
Content-Type: text/html
whereas I got previous:
HTTP/1.1 302 Moved Temporarily
Connection: close
Date: Wed, 02 Jun 2010 09:41:18 GMT
Set-Cookie: _session_id=<correct id>; path=/
Status: 302 Found
Location: <correct url>
Cache-Control: no-cache
Server: Mongrel 1.1.5
Content-Type: text/html; charset=utf-8
Content-Length: 93
Anyone knows how to fix this? Despite the fact that the redirect is not working, the login-cookie is not set too (but I think, this is both related somehow).
I have already tried to override redirect_to in order to set response.headers['Location'] etc., but they did not appear in the response.
EDIT: Ok, this seems to be a bug with mongrel_rails together with rails 2.3.8, script/server does not have this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信 Rails 2.3.8 不再支持 mongrel。尝试使用瘦应用程序服务器,您可能不会看到该错误。
I believe rails 2.3.8 no longer supports mongrel. Try with thin app server and you will probably not see that error.
如果您想继续使用 Mongrel,请访问此链接并向下滚动到 bshand 的评论以获取修复:
https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238
If you'd rather keep using Mongrel, visit this link and scroll down to the comment by bshand for the fix:
https://rails.lighthouseapp.com/projects/8994/tickets/4690-mongrel-doesnt-work-with-rails-238
我通过降级到 2.3.5 修复了位置缺失问题
I fix the Location missing issue by downgrading to 2.3.5