Custom 500 Error Page

530 views
Skip to first unread message

MarcoJ

unread,
Sep 9, 2008, 8:32:22 AM9/9/08
to Phusion Passenger Discussions
Hi,

Does anybody know how to replace the fancy mod_rails error page with
your own error page?

Thanks,

Marco

nick gorbikoff

unread,
Sep 10, 2008, 10:21:53 AM9/10/08
to Phusion Passenger Discussions
I don't think Passenger has any error pages. What I mean is if your
app breaks it will give you an error page with a trace stack - etc,
but it is not one of "standard" web error pages (404, 401, 500, etc)
Actually Rails pulls them from the public directory. So check
yourrailsapp/public/ folder - that where they are. I just simulated a
500 error and that's the tempalte that got pulled. There are should be
a few error pages their already by default. I'm not sure if "500" is
one of them as I added a lot of custom ones. But anyways Just create a
file that is called 500.html and place it in the root of the public
folder of your railsapp.
Hope that helps.
Nick

Kevin Willock

unread,
Sep 10, 2008, 10:24:09 AM9/10/08
to phusion-...@googlegroups.com
I think he's asking how to replace the default passenger error page,
ala the attached image. I'd like to know how to do this also!

090308_1.png

nick gorbikoff

unread,
Sep 10, 2008, 10:45:06 AM9/10/08
to Phusion Passenger Discussions
Nope - the Thread title - says - Custom 500 error page.
What you showed Kevin is an "app error page" or "debuging stack
trace" ( don't know what's the proper way to refer to it).
It's like regular Mongrel or Webrick error that they throw at you when
you do something wrong in your app, just nicely formatted by
Passenger, that is not one of you standard Web error code pages. Code
pages - just notify you of the status/state of the web site - they
don't actually provide you the error description and stack, as
potentially you could expose your internal private app info to an
outsider, when you are out on the web.

On a side note:
One of the grater examples of a custom 404 Error pages comes from
French car maker Pegaut:

http://www.peugeot.com/en/error.aspx
(they show an old 404 pegaut model that they used to make)


And jsut a couple of funny ones:
http://www.404error.info/
http://hamsteak.com/
http://www.limpfish.com/notfound.html
http://www.snopes.com/badpage

404 error page - taken to high art form:
http://lumino.us/404




On Sep 10, 9:24 am, Kevin Willock <xiph...@gmail.com> wrote:
> I think he's asking how to replace the default passenger error page,  
> ala the attached image. I'd like to know how to do this also!
>
>  090308_1.png
> 81KViewDownload

Tom Copeland

unread,
Sep 10, 2008, 11:05:13 AM9/10/08
to phusion-...@googlegroups.com

On Sep 10, 2008, at 10:24 AM, Kevin Willock wrote:

> I think he's asking how to replace the default passenger error page,
> ala the attached image. I'd like to know how to do this also!

The templates for these are in lib/passenger/templates/, so you could
edit them directly. Or you could munge
SpawnManager#handle_spawn_application (lib/passenger/spawn_manager.rb)
which is the code that controls rendering these templates.

Yours,

tom

nick gorbikoff

unread,
Sep 10, 2008, 12:07:33 PM9/10/08
to Phusion Passenger Discussions
Interesting, Tom, thou IMHO Phusion team did a good job with these
templates - I think i they are more readable than default rails ones.

BTW:
For anyone wondering default location for passenger (as with all the
gems) root folder should be in
/usr/local/lib/ruby/gems/1.8/passenger-x.x.x/ (x.x.x currently is
2.0.2)

MarcoJ

unread,
Sep 11, 2008, 6:25:26 AM9/11/08
to Phusion Passenger Discussions
Tom guessed it right: i want to replace the default passenger error
page. Thanks for the tip!

I do like the layout of the templates, but I don't want to show them
to the public.

Cheers,

Marco

Fredrik Bränström

unread,
Sep 20, 2008, 6:33:20 PM9/20/08
to Phusion Passenger Discussions
Those aren't shown in production mode. Or wait... they are. Hm. Should
they be?

Yaroslav Markin

unread,
Sep 23, 2008, 4:49:48 PM9/23/08
to phusion-...@googlegroups.com
Let's say a Phusion error page shows up when Rails fail to boot (1) and your very own error shows up when Rails is loaded and you've encountered an exception.

(1) Try to add a require to nonexistent file/gem in the very beginning of environment.rb.

I really would like to know how to hide Rails bootup error as well.


On Sun, Sep 21, 2008 at 2:33 AM, Fredrik Bränström <bran...@gmail.com> wrote:

Those aren't shown in production mode. Or wait... they are. Hm. Should
they be?



--
Yaroslav Markin
evilmartians.com | rubyonrails.ru
Reply all
Reply to author
Forward
0 new messages