Search code examples
ruby-on-railserror-handlingpostmanwebrick

Rails/WEBrick error page forwarding


I have a ruby-on-rails application running locally on a WEBrick server. I am using Postman to trigger HTTP Methods (POST, GET, etc) in order to check if any error page is shown to the users. The figure below shows one of the error pages found when performing a POST to the home page:

WEBrick Error page

As one can note, the physical path to the application directory is disclosed: /home/dennis/dunbarwebsite

Leaking this kind of information may help one fine-tune attacks against the application. Hence, I would like to know if it is possible to forward this error page to a custom one, like the custom redirection to errors 404 and 500.

Thanks in advance, Dennis.


Solution

    1. That error page only appears in development mode.
    2. Add a catchall route at the end of routes.rb:

    match "*path", to: redirect('/'), via: :all