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

后端 未结 3 366
盖世英雄少女心
盖世英雄少女心 2020-12-11 04:02

I currently have:

$ rails s
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=         


        
相关标签:
3条回答
  • 2020-12-11 04:17

    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.

    0 讨论(0)
  • 2020-12-11 04:20

    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
    
    0 讨论(0)
  • 2020-12-11 04:29

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

    WEBrick::HTTPRequest.const_set("MAX_URI_LENGTH", 10240)
    
    0 讨论(0)
提交回复
热议问题