My project worked in development good, but in production:
"Puma caught this error: Missing secret_token and secret_key_base for 'production' environment, set these values in config/secrets.yml (RuntimeError)"
Then I edited the file "secrets.yml" and now I can't run no one rails server (this and other projects).
SSL connection error
rails s (any project which used puma):
HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2015-11-21 18:31:21 +0200: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"text/plain", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.11.1", "GATEWAY_INTERFACE"=>"CGI/1.2"}
rails s (any project which used webrick)
[2015-11-21 18:33:04] INFO WEBrick 1.3.1 [2015-11-21 18:33:04] INFO ruby 2.2.3 (2015-08-18) [x86_64-linux] [2015-11-21 18:33:04] INFO WEBrick::HTTPServer#start: pid=28129 port=3000 [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03�[\x0E\x0ERqp'. [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03a"|1�\f�I+d��J�<i]o\x1Ad�]v\x11N�wH��ҧ\x00\x00 �+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:05] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03��Vƿ�(�p\v�"\x03�Isj�|�;��xP'�&,���\x00\x00 �+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:06] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x03\x06V���[Y�R$\x7F���c�H'. [2015-11-21 18:33:06] ERROR bad URI `�+�/\x00��\x14�\x13�\x15�'. [2015-11-21 18:33:06] ERROR bad URI `a��'. [2015-11-21 18:33:06] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x01�'*��[�����\x10r��t(�)�M������\x02��mG\x00\x00\x14�'. ^Z^C[2015-11-21 18:39:53] INFO going to shutdown ... [2015-11-21 18:39:53] INFO WEBrick::HTTPServer#start done.
Note: the project which i edited was cloned from github
You’re trying to connect over SSL (i.e. with HTTPS), but the server doesn’t understand it. It is trying to interpret the SSL handshake as the HTTP request, which results in the error.
Use plain HTTP: http://localhost:3000.
Related
I started a simple rails server and set the root url to display an html page. It started on localhost:3000 but when I try to access it using my browser (Internet Explorer 8) it says page cannot be diaplyed. The console is not showing any error. It just says server running on localhost:3000
Console output
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-04-27 12:32:39] INFO WEBrick 1.3.1
[2016-04-27 12:32:39] INFO ruby 2.2.4 (2015-12-16) [i386-mingw32]
[2016-04-27 12:32:39] INFO WEBrick::HTTPServer#start: pid=5752 port=3000
The most probable problem of that you have firewall and it blocks the requests to server, additionally it could be happened that name localhost is redefined, so I'll propose a 3 steps to fix:
Drop your firewall or reset it to allow accessing to 127.0.0.1, that should be resolved as localhost;
Restart app as:
rails s -b 127.0.0.1
key -b tells your server to bind it on just IP: 127.0.0.1;
Enter url: http://127.0.0.1:3000
Before you mark this as a duplicate, know that the difference between this question and the other questions is there are no errors in the console or logs for me!
=> Booting WEBrick
=> Rails 5.0.0.alpha application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-10-25 17:32:22] INFO WEBrick 1.3.1
[2015-10-25 17:32:22] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin14]
[2015-10-25 17:32:22] INFO WEBrick::HTTPServer#start: pid=33823 port=3000
Started GET "/" for 127.0.0.1 at 2015-10-25 17:32:35 -040
Produces a 500 internal server error: "We're sorry but something went wrong. If you are the application owner check the logs for more information."
I've tried:
changing the rack version to 1.6.2 (ruby requires >2.0)
using a different port
binding the rails server to localhost
hitting 127.0.0.1:3000, 0.0.0.1:3000, etc
Any ideas?
I am newbie in ruby on rails. I'm currently installing Ruby on Rails.
I've done all the steps until : bundle install.
Then i type rails server to start the rails server. From what I read in http://guides.rubyonrails.org/command_line.html, after i type rails server, it's supposed to show:
$ cd commandsapp
$ bin/rails server
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-08-07 02:00:01] INFO WEBrick 1.3.1
[2013-08-07 02:00:01] INFO ruby 2.0.0 (2013-06-27) [x86_64-darwin11.2.0]
[2013-08-07 02:00:01] INFO WEBrick::HTTPServer#start: pid=69680 port=3000
but in my Command Line it show this, instead:
So the rails server is not running and when i type localhost:3000 or localhost:8000 in the browser, it says unable to connect(probably because the server isn't running).
Sorry my bad language.
You need to create a rails app and change into that directory before you can run the server. Try this:
rails new commandsapp # the name can be anything you want
cd commandsapp
rails server
"rails new " creates a new folder with the default rails layout (app, db, log etc).
The Error: 'require' : cannot load such file -- sqlite3/sqlite3_native (LoadError)
==> You must insert gem sqlite3/sqlite3_native into gemfile, then bundle install again. Try with rails server.
So this issue is pretty straight forward:
** Exception RuntimeError in Rack application object (Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`) (process 31929, thread 0x95116e4(Worker 1))
So I did that, I went and added the secrets.yml file to the appname/current/config/ directory and added:
production:
secret_key_base: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
And then I restarted the server.
Still I get this 500 error and still the error.log sais that I am missing this file. Am I missing some basic step here?
Note: This is running with passenger and apache2
Whenever I execute "rails server" and try to visit https://localhost:3000, I get the following error message. Any Idea what's going on?
Thanks!
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-02-04 14:00:34] INFO WEBrick 1.3.1
[2014-02-04 14:00:34] INFO ruby 2.0.0 (2013-11-22) [x86_64-darwin12.5.0]
[2014-02-04 14:00:34] INFO WEBrick::HTTPServer#start: pid=25445 port=3000
[2014-02-04 14:00:37] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03R?8?Rcd?0j?`\\?6?>??f?&-??pB???B\x00\x00J\x00??$?#?'.
[2014-02-04 14:00:37] ERROR bad URI `"^;?\x00?D\x1D??׆?wјH?\x15?.\x10M?\x00\x00J\x00??$?#?'.
[2014-02-04 14:00:37] ERROR bad Request-Line `\x16\x03\x00\x00E\x01\x00\x00A\x03\x00R?8հBo?㦈r?\x19'.
You're trying to connect via HTTPS, which is not supported. WEBrick is expecting plain HTTP so it does not know how to parse the encrypted request.
Unless you really need HTTPS in development, just use HTTP. If you need HTTPS, it is possible to do so but will require some configuration changes. For example, look at this question for how to do it with thin.