WEBrick: RequestURITooLarge: should I update or use a different server?

情到浓时终转凉″ 提交于 2019-11-28 12:17:52

In Ruby 1.9.3. source, it says that MAX_URI_LENGTH = 2083. That means that the latest version of Webrick can't handle urls longer that this. And that's what the WEBrick::HTTPStatus::RequestURITooLarge exception is telling you.

The solution therefore is to use a different web server. One of the most favourite ones is Thin:

sudo gem install thin

cd to/your/rails/app

thin -h

thin -a localhost start

Like said here, you could change the MAX_URI_LENGTH using this code:

WEBrick::HTTPRequest.const_set("MAX_URI_LENGTH", 10240)

I see you've tried unicorn: have you tried running it through bundler? Add:

gem :unicorn

to your Gemfile and run:

bundle exec unicorn_rails

to start the server and browse to http://localhost:8080.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!