You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1998/05/23 03:37:16 UTC

[PATCH] Make ErrorDocuments work for Proxy Errors

The appended patch addresses a couple of deficiencies of the proxy module
as it is today:
*   Proxy errors cannot be caught and returned with a nicer ErrorDocument
    wrapper. The reason for this is that mod_proxy uses its own error
    routine (because the canned 500 response is inappropriate and
    unsufficient to display the extra information about the proxy failure
    reason).

    The patch allows mod_proxy to return the error reason to the
    ap_send_error_response() by using an r->notes string called
    "proxy-error". This string is passed to CGI scripts / ErrorDocuments
    in a newly created "extra" environment variable "REDIRECT_PROXY_ERROR".
    The generated TITLE and H1 tags can now be overridden by setting
    r->status_line to a message in the "nnn Reason" format.
    This allows mod_proxy to return a "500 Proxy Error" in the TITLE and
    H1 tags instead of the canned "500 Internal Server Error".

*   The proxy-private error logger ap_proxy_log_uerror() was removed, the
    normal ap_log_error() is used for error outputs now.

*   Many messages were updated to be more informative.

If you know some "secrets" about why the proxy private logging must *not*
be replaced by ap_log_error(), please share them with me ;-)

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Martin Kraemer <Ma...@mch.sni.de>.
I forgot to mention:
*   See also:
    PR #1259 proxy error messages
	     "Mapping the proxy error messages via ErrorDocuments would also
	     be nice...
	      -- Rainer"
    PR #494 Allow customized messages for ProxyBlock
	     "I'd like to be able to (at minimum) substitute my own
	     message there, and optimally be able to use
	     the full error message functionality (such as to log the
	     attempt to a special file, send someone email, etc.)"

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Chuck Murcko <ch...@topsail.org>.
Nope, no secrets. The time Ben and I spent on the proxy was just
intended to get it more reliable and functional.

Martin Kraemer wrote:
> 
> The appended patch addresses a couple of deficiencies of the proxy module
> as it is today:
> *   Proxy errors cannot be caught and returned with a nicer ErrorDocument
>     wrapper. The reason for this is that mod_proxy uses its own error
>     routine (because the canned 500 response is inappropriate and
>     unsufficient to display the extra information about the proxy failure
>     reason).
> 
>     The patch allows mod_proxy to return the error reason to the
>     ap_send_error_response() by using an r->notes string called
>     "proxy-error". This string is passed to CGI scripts / ErrorDocuments
>     in a newly created "extra" environment variable "REDIRECT_PROXY_ERROR".
>     The generated TITLE and H1 tags can now be overridden by setting
>     r->status_line to a message in the "nnn Reason" format.
>     This allows mod_proxy to return a "500 Proxy Error" in the TITLE and
>     H1 tags instead of the canned "500 Internal Server Error".
> 
> *   The proxy-private error logger ap_proxy_log_uerror() was removed, the
>     normal ap_log_error() is used for error outputs now.
> 
> *   Many messages were updated to be more informative.
> 
> If you know some "secrets" about why the proxy private logging must *not*
> be replaced by ap_log_error(), please share them with me ;-)
> 
>     Martin
> --
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 
>   ------------------------------------------------------------------------
> 
>                                                 Name: proxy_ErrorDoc_and_aplogerror.patch
>    proxy_ErrorDoc_and_aplogerror.patch          Type: Plain Text (text/plain)
>                                          Description: Proxy ErrorDocument and ap_log_error() patch

-- 
chuck
Chuck Murcko            The Topsail Group             West Chester PA
USA
chuck@topsail.org

Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Marc Slemko <ma...@worldgate.com>.
Actually, I started on something like this a while ago but, like
everything in my poor life, never got around to finishing.

Do this, then make it available to CGIs in the environment (for
ErrorDocument CGIs) and have an option to display it in the error message
generated.

On Mon, 25 May 1998, Martin Kraemer wrote:

> On Sun, May 24, 1998 at 05:33:33PM -0700, Dean Gaudet wrote:
> > Looks fine... although I don't like the addition of yet-another hook for
> > the proxy in the core.  Whoever works on the API for 2.0 should be
> > intimate with how the proxy works so they can plan for it in the API.
> > 
> > Dean
> 
> > >     The patch allows mod_proxy to return the error reason to the
> > >     ap_send_error_response() by using an r->notes string called
> > >     "proxy-error". This string is passed to CGI scripts / ErrorDocuments
> > >     in a newly created "extra" environment variable "REDIRECT_PROXY_ERROR".
> 
> So how about a "more general" solution by renaming "proxy-error" and
> $REDIRECT_PROXY_ERROR to "module-notes" and $MODULE_NOTES? And maybe adding
> them -if set- to every error message, not just 500?
> 
> After all, other modules have a need to add failure reasons to the canned
> replies as well.
> 
> Howzzat?
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 


Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Dean Gaudet <dg...@arctic.org>.

On Mon, 25 May 1998, Martin Kraemer wrote:

> So how about a "more general" solution by renaming "proxy-error" and
> $REDIRECT_PROXY_ERROR to "module-notes" and $MODULE_NOTES? And maybe adding
> them -if set- to every error message, not just 500?

Call it something more descriptive like "error-notes" and ERROR_NOTES and
I'm +1 :) 

Dean



Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Sun, May 24, 1998 at 05:33:33PM -0700, Dean Gaudet wrote:
> Looks fine... although I don't like the addition of yet-another hook for
> the proxy in the core.  Whoever works on the API for 2.0 should be
> intimate with how the proxy works so they can plan for it in the API.
> 
> Dean

> >     The patch allows mod_proxy to return the error reason to the
> >     ap_send_error_response() by using an r->notes string called
> >     "proxy-error". This string is passed to CGI scripts / ErrorDocuments
> >     in a newly created "extra" environment variable "REDIRECT_PROXY_ERROR".

So how about a "more general" solution by renaming "proxy-error" and
$REDIRECT_PROXY_ERROR to "module-notes" and $MODULE_NOTES? And maybe adding
them -if set- to every error message, not just 500?

After all, other modules have a need to add failure reasons to the canned
replies as well.

Howzzat?

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Make ErrorDocuments work for Proxy Errors

Posted by Dean Gaudet <dg...@arctic.org>.
Looks fine... although I don't like the addition of yet-another hook for
the proxy in the core.  Whoever works on the API for 2.0 should be
intimate with how the proxy works so they can plan for it in the API.

Dean

On Sat, 23 May 1998, Martin Kraemer wrote:

> The appended patch addresses a couple of deficiencies of the proxy module
> as it is today:
> *   Proxy errors cannot be caught and returned with a nicer ErrorDocument
>     wrapper. The reason for this is that mod_proxy uses its own error
>     routine (because the canned 500 response is inappropriate and
>     unsufficient to display the extra information about the proxy failure
>     reason).
> 
>     The patch allows mod_proxy to return the error reason to the
>     ap_send_error_response() by using an r->notes string called
>     "proxy-error". This string is passed to CGI scripts / ErrorDocuments
>     in a newly created "extra" environment variable "REDIRECT_PROXY_ERROR".
>     The generated TITLE and H1 tags can now be overridden by setting
>     r->status_line to a message in the "nnn Reason" format.
>     This allows mod_proxy to return a "500 Proxy Error" in the TITLE and
>     H1 tags instead of the canned "500 Internal Server Error".
> 
> *   The proxy-private error logger ap_proxy_log_uerror() was removed, the
>     normal ap_log_error() is used for error outputs now.
> 
> *   Many messages were updated to be more informative.
> 
> If you know some "secrets" about why the proxy private logging must *not*
> be replaced by ap_log_error(), please share them with me ;-)
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
>