Note that there are some explanatory texts on larger screens.

plurals
  1. POInternal Server Error 500 gets thrown instead of 404 while trying to access broken picture urls
    primarykey
    data
    text
    <p>We have a rails server with custom 404 and 500 pages setup using this tutorial here:</p> <p><a href="http://ramblinglabs.com/blog/2012/01/rails-3-1-adding-custom-404-and-500-error-pages">http://ramblinglabs.com/blog/2012/01/rails-3-1-adding-custom-404-and-500-error-pages</a></p> <p>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, ...</p> <p>But something like en/file.foo throws 404. So only valid suffixes throw a 500.</p> <p><strong>End of routes.rb:</strong></p> <pre><code>if Rails.application.config.consider_all_requests_local match '*not_found', to: 'errors#error_404' end </code></pre> <p><strong>application_controller.rb</strong></p> <pre><code> 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 </code></pre> <p><strong>500 that appears:</strong></p> <pre><code>Missing template errors/error_404 with {:locale=&gt;[:de, :en], :formats=&gt;[:png], :handlers=&gt;[:erb, :builder, :coffee, :arb, :haml]} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload