rails 4: custom error pages for 404, 500 and where is the default 500 error message coming from?

后端 未结 4 2000
悲&欢浪女
悲&欢浪女 2020-11-27 13:35

Currently in production im getting this text:

500 Internal Server Error
If you are the administrator of this website, then please read this web application\'         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 13:54

    Here is latest and quick fix for showing custom 404_error page.

    • Add below lines in development.rb or production.rb as per your env.

    config.exceptions_app = self.routes

    config.consider_all_requests_local = false

    • Remove all rm public/{404,500,422}.html
    • Create 404.html.erb file in static folder of your rails project. You can add your custom html here.(this will be using your application layout so don't bother about header and footer content)

提交回复
热议问题