Bhav
Bhav

Reputation: 2207

Rails app on Heroku doesn't display 'Welcome aboard' page

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

Upvotes: 0

Views: 336

Answers (2)

puneet18
puneet18

Reputation: 4427

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"

Upvotes: 1

Alejandro Montilla
Alejandro Montilla

Reputation: 2654

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"

Upvotes: 0

Related Questions