2011-11-30 52 views
5

我目前有:WEBrick:RequestURITooLarge:我應該更新還是使用不同的服務器?

$ rails s 
=> Booting WEBrick 
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
[2011-11-30 13:18:00] INFO WEBrick 1.3.1 
[2011-11-30 13:18:00] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.8.0] 
[2011-11-30 13:18:00] INFO WEBrick::HTTPServer#start: pid=4204 port=3000 

我有是我使用OpenID進行身份驗證,並收到以下錯誤的問題:

[2011-11-30 13:18:19] ERROR WEBrick::HTTPStatus::RequestURITooLarge 

在瀏覽器:

Request-URI Too Large 
WEBrick::HTTPStatus::RequestURITooLarge 
WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18) at macbook-pro.local:3000 

我該如何解決這個問題?我可以更新WEBrick嗎?還是我真的需要使用不同的Web服務器?

感謝

+0

我試過麒麟卻得到:您已經激活架1.3.3,但你的Gemfile需要機架1.2.4。考慮使用bundle exec。 (Gem :: LoadError) – AnApprentice

+0

需要添加這是一個本地主機問題。我試圖只在本地修復本地修正的bug, – AnApprentice

回答

8

在Ruby 1.9.3中。來源,它表示MAX_URI_LENGTH = 2083.這意味着Webrick的最新版本不能再處理這個網址。這就是WEBrick :: HTTPStatus :: RequestURITooLarge異常告訴你的。

因此,解決方案是使用不同的Web服務器。其中最喜歡的人是瘦:

sudo gem install thin 

cd to/your/rails/app 

thin -h 

thin -a localhost start 
+0

當我嘗試的東西時,我收到一個錯誤:/.rvm/gems/[email protected]/gems/bundler-1.0.15/lib/bundler/runtime.rb:31:in'block in setup' :您已經啓動機架1.3.3,但您的Gemfile需要機架1.2.4。考慮使用bundle exec。 (Gem :: LoadError) – AnApprentice

+0

好吧,算了一下。是不是顯示像webrick一樣的軌道記錄? – AnApprentice

+0

等等,這是本地的...你是說我應該用本地的東西? – AnApprentice

0

我看你已經試過麒麟:你嘗試運行它通過捆綁?地址:

gem :unicorn 

Gemfile並運行:

bundle exec unicorn_rails 

啓動服務器和瀏覽http://localhost:8080

+0

運行bundle exec rails加載啓動WEBrick – AnApprentice

+0

糟糕:你是對的。你需要在根目錄下運行'bundle exec unicorn_rails'。更新了答案。 – chrismdp

0

said here,您可以使用此代碼改變MAX_URI_LENGTH

WEBrick::HTTPRequest.const_set("MAX_URI_LENGTH", 10240) 
相關問題