martin 98/06/08 12:47:12
Modified: htdocs/manual/misc custom_errordocs.html Log: Update the document to include information about the new ERROR_NOTES variable Revision Changes Path 1.5 +52 -15 apache-1.3/htdocs/manual/misc/custom_errordocs.html Index: custom_errordocs.html =================================================================== RCS file: /export/home/cvs/apache-1.3/htdocs/manual/misc/custom_errordocs.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- custom_errordocs.html 1998/05/20 14:22:40 1.4 +++ custom_errordocs.html 1998/06/08 19:47:11 1.5 @@ -25,6 +25,7 @@ <LI><A HREF="#headfoot">The common header and footer files</A> <LI><A HREF="#createdocs">Creating ErrorDocuments in different languages</A> <LI><A HREF="#fallback">The fallback language</A> + <LI><A HREF="#proxy">Customizing Proxy Error Messages</A> <LI><A HREF="#listings">HTML listing of the discussed example</A> </UL> <HR> @@ -130,11 +131,11 @@ a .htaccess file in the /errordocs directory: a minor speed optimization. </OL> -The resulting <SAMP>httpd.conf</SAMP> configuration would the look -similar to this: <SMALL>(Note that you can defrine your own error +The resulting <SAMP>httpd.conf</SAMP> configuration would then look +similar to this: <SMALL>(Note that you can define your own error messages using this method for only part of the document tree, e.g., a /~user/ subtree. In this case, the configuration could as well -be put into the .htaccess file at the root of the subtree. In this case, +be put into the .htaccess file at the root of the subtree, and the <Directory> and </Directory> directives -but not the contained directives- must be omitted.)</SMALL> <PRE> @@ -177,10 +178,10 @@ <LI>No file errordocs/403 should exist. Otherwise, it would be found and served (with the DefaultType, usually text/plain), all negotiation would be bypassed. - <LI>For each language for which we have a translation (note that this need not - be the same set of languages for each error code - you can get by - with a single language version until you actually <EM>have</EM> - translated versions), a document + <LI>For each language for which we have an internationalized version + (note that this need not be the same set of languages for each + error code - you can get by with a single language version until + you actually <EM>have</EM> translated versions), a document <SAMP>errordocs/403.shtml.<EM>lang</EM></SAMP> is created and filled with the error text in that language (<A HREF="#createdocs">see below</A>). @@ -222,7 +223,7 @@ <CODE>foot.shtml.fr</CODE>,<BR> <CODE>foot.shtml.de</CODE>,<BR> <CODE>foot.shtml</CODE> symlink to <CODE>foot.shtml.en</CODE><P> -Both files are then simply included into the error document by using the +Both files are included into the error document by using the directives <CODE><!--#include virtual="head" --></CODE> and <CODE><!--#include virtual="foot" --></CODE> respectively: the rest of the magic occurs in mod_negotiation and @@ -281,6 +282,45 @@ <P> </P> +<H2><A NAME="proxy">Customizing Proxy Error Messages</A></H2> + +<P> + As of Apache-1.3, it is possible to use the <CODE>ErrorDocument</CODE> + mechanism for proxy error messages as well (previous versions always + returned fixed predefined error messages). +</P> +<P> + Most proxy errors return an error code of [500 Internal Server Error]. + To find out whether a particular error document was invoked on behalf + of a proxy error or because of some other server error, and what the reason + for the failure was, you can check the contents of the new + <CODE>ERROR_NOTES</CODE> CGI environment variable: + if invoked for a proxy error, this variable will contain the actual proxy + error message text in HTML form. +</P> +<P> + The following excerpt demonstrates how to exploit the <CODE>ERROR_NOTES</CODE> + variable within an error document: +</P> +<PRE> + <!--#if expr="\"$REDIRECT_ERROR_NOTES\" = \"\"" --> + <p> + The server encountered an unexpected condition + which prevented it from fulfilling the request. + </p> + <p> + <A HREF="mailto:<!--#echo var="SERVER_ADMIN" -->" + SUBJECT="Error message [<!--#echo var="REDIRECT_STATUS" -->] <!--#echo var="title" --> for <!--#echo var="REQUEST_URI" -->"> + Please forward this error screen to <!--#echo var="SERVER_NAME" -->'s + WebMaster</A>; it includes useful debugging information about + the Request which caused the error. + <pre><!--#printenv --></pre> + </p> + <!--#else --> + <!--#echo var="REDIRECT_ERROR_NOTES" --> + <!--#endif --> +</PRE> + <H2><A NAME="listings">HTML listing of the discussed example</A></H2> So, to summarize our example, here's the complete listing of the @@ -383,12 +423,9 @@ <H3>More welcome!</H3> If you have tips to contribute, send mail to <A -HREF="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A> - -<HR> - -<A HREF="./"><IMG SRC="../images/index.gif" ALT="Index"></A> -<A HREF="../"><IMG SRC="../images/home.gif" ALT="Home"></A> +HREF="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</A> -</BODY></HTML> + <!--#include virtual="footer.html" --> +</BODY> +</HTML>