OmniAuth Google OpenID WEBrick::HTTPStatus::RequestURITooLarge
我正在使用 OmniAuth 来允许用户使用他们的 Google OpenID 帐户登录。当我尝试使用 WEBrick 以开发模式登录时,出现 WEBrick::HTTPStatus::RequestURITooLarge 错误。当我将它部署到我的 Rails 主机时,它工作正常。 我应该使用其他 Web 服务器来代替 WEBrick 吗?
I am using OmniAuth to allow users to log in with their Google OpenID accounts. When I try to log in in development mode with WEBrick, I get a WEBrick::HTTPStatus::RequestURITooLarge error. When I deploy it to my rails host, it works fine.
Is there a different web server I should use instead of WEBrick?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
奇怪,我想知道 WEBrick 的 URI 长度限制是多少。您可以尝试
thin
http://code.macournoyer.com/thin/。我有时在本地使用它进行开发,看起来效果很好。Strange, I wonder what the URI length limit is for WEBrick. You could try
thin
http://code.macournoyer.com/thin/. I use this locally for development sometimes and it seems to work great.正如 OmniAuth 的 Railscast 236 中提到的,WEBrick 无法处理 OpenID 给出的长 URL。对我有用的解决方案是将 Mongrel 添加到您的 gemfile 中。
As mentioned in railscast 236 for OmniAuth, WEBrick has trouble with long urls given by OpenID. The solution given that worked for me was to add Mongrel to your gemfile.
将名为
webrick.rb
的文件添加到config\initializers
目录。Add a file called
webrick.rb
file to theconfig\initializers
directory.在最新的 ruby 源中,url 大小限制已从 1024 更改为 2083。我希望包含此修复的更新后的 ruby 版本很快就会发布:)
https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L291
The url size limit changed from 1024 to 2083 in the latest ruby source already. I hope an updated ruby version with this fix included will be released soon :)
https://github.com/ruby/ruby/blob/trunk/lib/webrick/httprequest.rb#L291
我使用 Webbrick 和一个表,使用 Caseproof's DataTables gem 遇到了同样的问题有很多列(> 15)。切换到瘦服务器也解决了我的问题。 DataTables 是一个用于创建表的 javascript/jquery 插件。
I ran into this same issue with Caseproof's DataTables gem using Webbrick and a table that had a lot of columns (> 15). Switching to the thin server resolved my issue as well. DataTables is a javascript/jquery plugin for creating tables.