how do i create a custom internal server error page? .htaccess?

2008-02-20 Thread johnnyice

Hi!

When I turn debug to false and there is a problem with my code I am
redirected to a blank page that reads internal server error.  okay,
that is supposed to happen... but I want my chrome around that.

usually i would just define a line in my .htaccess file and point it
to the page I want to display.  however i don't know if htaccess is
appropriate nor where to put it (I tried /public and a couple other
folders and nothing seems to pick up).


any ideas?


thanks!
john
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: how do i create a custom internal server error page? .htaccess?

2008-02-20 Thread Graham Dumpleton

On Feb 21, 1:40 pm, johnnyice [EMAIL PROTECTED] wrote:
 Hi!

 When I turn debug to false and there is a problem with my code I am
 redirected to a blank page that reads internal server error.  okay,
 that is supposed to happen... but I want my chrome around that.

 usually i would just define a line in my .htaccess file and point it
 to the page I want to display.  however i don't know if htaccess is
 appropriate nor where to put it (I tried /public and a couple other
 folders and nothing seems to pick up).

It possibly depends on which level in the WSGI stack or underlying
WSGI adapter for the web server you are using to host your application
that generates the page.

Am sure Pylons probably has an inbuilt mechanism for providing
customised error pages and someone else will no doubt point you to
that, but in terms of generic WSGI applications the following would
apply.

If somewhere down in the WSGI stack is capturing the exception and
generating a complete 500 response including response content, then
you would need to introduce a middleware component that detects that
500 response and changes it as it is passed up.

If the exception isn't being caught and is instead propagating right
back up to the WSGI server adapter and it is that which is generating
the 500 response, then you would use a middleware component that
catches the exception and generates a complete 500 response of its own
from scratch.

A more tricky situation although not likely to occur for your case, is
where for some reason an error occurs within the WSGI adapter itself
and it generates its own complete 500 response for that error. Because
there is no user code between it and the web client, it is much harder
to intercept and modify it. One possibility here though is if you are
running  behind mod_proxy. In that case you can intercept it in Apache
by setting ProxyOverrideError to On. Doing this will result in
appropriate error responses being redirected internally by Apache to
the page appropriate for the ErrorDocument URL for that error status,
thus allowing it to replace the error page. This is useful where you
need to make error pages consistent across many applications being
fronted by the one Apache. Because it is being handled in Apache
though, you loose access to any context information such as stack
traces which would be available to the WSGI application itself. Not
even sure you get access to the original error response content as
that is most likely discarded.

To help answer the question you may want to be clearer about whether
you are using Paste serve and/or mod_proxy.

Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---