0

I've created a new Rails app. When I run the Rails app locally using the rails server command, the default 'Welcome aboard' page displays. I've deployed this to Heroku, however when I try to access the Heroku app, I receive a The page you were looking for doesn't exist. message.

Why don't I receive the default 'Welcome aboard' page?

Heroku logs:

2017-03-13T19:40:33.717559+00:00 heroku[router]: at=info method=GET path="/" host=XXXXX.herokuapp.com request_id=58aa5f0e-c83b-411b-a27c-484325f2eaf0 fwd="90.208.48.181" dyno=web.1 connect=1ms service=6ms status=404 bytes=1829 protocol=https

2017-03-13T19:40:33.715776+00:00 app[web.1]: Started GET "/" for 90.208.48.181 at 2017-03-13 19:40:33 +0000

2017-03-13T19:40:33.717555+00:00 app[web.1]: 

2017-03-13T19:40:33.717557+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):

2017-03-13T19:40:33.717559+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'

2017-03-13T19:40:33.717560+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'

2017-03-13T19:40:33.717561+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:38:in `call_app'

2017-03-13T19:40:33.717561+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:20:in `block in call'

2017-03-13T19:40:33.717562+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'

2017-03-13T19:40:33.717562+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:26:in `tagged'

2017-03-13T19:40:33.717563+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/tagged_logging.rb:68:in `tagged'

2017-03-13T19:40:33.717563+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/rack/logger.rb:20:in `call'

2017-03-13T19:40:33.717564+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'

2017-03-13T19:40:33.717564+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'

2017-03-13T19:40:33.717565+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'

2017-03-13T19:40:33.717566+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'

2017-03-13T19:40:33.717566+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/static.rb:116:in `call'

2017-03-13T19:40:33.717567+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'

2017-03-13T19:40:33.717567+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/engine.rb:518:in `call'

2017-03-13T19:40:33.717567+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/railties-4.2.5/lib/rails/application.rb:165:in `call'

2017-03-13T19:40:33.717568+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'

2017-03-13T19:40:33.717568+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'

2017-03-13T19:40:33.717568+00:00 app[web.1]:   vendor/bundle/ruby/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'

2017-03-13T19:40:33.717569+00:00 app[web.1]:   vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'

2017-03-13T19:40:33.717569+00:00 app[web.1]:   vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'

2017-03-13T19:40:33.717570+00:00 app[web.1]:   vendor/ruby-2.2.6/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

2017-03-13T19:40:33.717570+00:00 app[web.1]: 

2017-03-13T19:40:33.717570+00:00 app[web.1]: 

Gemfile:

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# bootstrap
gem 'bootstrap-sass',       '3.2.0.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails',         '4.0.3'
gem 'jquery-ui-rails', '~> 4.2.1'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end
Bhav
  • 1,957
  • 7
  • 33
  • 66
  • 1
    No need for Gemfile here for this one. How about more of them logs, though? – NM Pennypacker Mar 13 '17 at 19:36
  • @NickM Added to the OP. – Bhav Mar 13 '17 at 19:41
  • Hello, do you think would be useful seeing the routes.rb file? – Fabrizio Bertoglio Mar 13 '17 at 19:51
  • @FabrizioBertoglio It's empty. – Bhav Mar 13 '17 at 20:39
  • Yes, I think @Alejandro Montilla found the problem. I hope :) – Fabrizio Bertoglio Mar 13 '17 at 20:50
  • You are speaking of the page, "You are riding ruby on rails" – Fabrizio Bertoglio Mar 13 '17 at 20:51
  • I think because it is located in your public folder. This means that if you do not have any route, the files in the public folder will still be served. This files will not use the routes.rb routing rules. It depends from your rails version, in this discussion they say that is included in the following path `/Users/7stud/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/templates/rails/welcome/index.html.erb` http://stackoverflow.com/questions/17964830/where-is-the-default-welcome-aboard-page-located-in-my-app#17965106 – Fabrizio Bertoglio Mar 13 '17 at 20:54

2 Answers2

1

Welcome page is default index.html file present in public folder.

If no root is specified in routes.rb file then default index.html page is displayed.

It works well on ngnix/apache serve but might be not work on heroku.

If you want to display a page then create a controller eg HomeController and add file index.html under views/home and add below code in route.rb

root => "home#index"
puneet18
  • 4,341
  • 2
  • 21
  • 27
0

I think something similar happened to me, you must check your routes.rb file, to check if you have a root route, something like:

# File: config/routes.rb
root "controller#action" #something like:  root "clients#index"
Alejandro Montilla
  • 2,626
  • 3
  • 31
  • 35
  • My routes.rb is empty. My issue is why do I get a 'Welcome Aboard page' when running locally but nothing when deployed on Heroku? – Bhav Mar 13 '17 at 20:41
  • That is the problem, you need to "tell to the server" what to show in your `root` route. You can try access to some `controller#action` and you should see that action without any problem. Let me know if I explain my point. – Alejandro Montilla Mar 13 '17 at 20:46
  • How does the 'Welcome aboard' page route? – Bhav Mar 13 '17 at 20:48