Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7837969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:56:04+00:00 2026-06-02T14:56:04+00:00

We have a rails server with custom 404 and 500 pages setup using this

  • 0

We have a rails server with custom 404 and 500 pages setup using this tutorial here:

http://ramblinglabs.com/blog/2012/01/rails-3-1-adding-custom-404-and-500-error-pages

While it works nice and throws 404s for all kinds of paths, it generates internal server errors 500 while trying to access any kind of suffixed path like en/foo.png, en/foo.pdf, en/foo.xml, …

But something like en/file.foo throws 404. So only valid suffixes throw a 500.

End of routes.rb:

if Rails.application.config.consider_all_requests_local
  match '*not_found', to: 'errors#error_404'
end

application_controller.rb

  unless Rails.application.config.consider_all_requests_local
    rescue_from Exception, with: :render_500
    rescue_from ActionController::RoutingError, with: :render_404
    rescue_from ActionController::UnknownController, with: :render_404
    rescue_from ::AbstractController::ActionNotFound, with: :render_404
    rescue_from ActiveRecord::RecordNotFound, with: :render_404
  end

  protected

  def render_404(exception)
    @not_found_path = exception.message
    respond_to do |format|
      format.html { render template: 'errors/error_404', layout: 'layouts/application', status: 404 }
      format.all { render nothing: true, status: 404 }
    end
  end

  def render_500(exception)
    logger.fatal(exception)
    respond_to do |format|
      format.html { render template: 'errors/error_500', layout: 'layouts/application', status: 500 }
      format.all { render nothing: true, status: 500}
    end
  end

500 that appears:

Missing template errors/error_404 with {:locale=>[:de, :en], :formats=>[:png], :handlers=>[:erb, :builder, :coffee, :arb, :haml]}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T14:56:08+00:00Added an answer on June 2, 2026 at 2:56 pm

    We found the mistake.

    We had an error_controller.rb containing this:

      def error_404
        @not_found_path = params[:not_found]
        render template: 'errors/error_404', layout: 'layouts/application', status: 404
      end
    

    and we changed it to fix this problem to:

      def error_404
        @not_found_path = params[:not_found]
        respond_to do |format|
          format.html { render template: 'errors/error_404', layout: 'layouts/application', status: 404 }
          format.all { render nothing: true, status: 404 }
        end
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails application hosted on Heroku using a custom Domain. The application
I have a Procfile like so: web: bundle exec rails server -p $PORT em:
I have a rails app that I'm moving to another server and I figure
I have a rails app and I want to deploy it on a server
I have a ruby on rails app running a server and sometimes it needs
I have a Ruby on Rails app running on my server, and I can't
I would like to have individuals config for my rails apps on my server,
Trying to get my server to serve my rails apps. I have a test
I have a Rails server, and I want my Java desktop application & android
I have an Rails application server that is listening on port 9000, and is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.