Re: ModPerl::Registry and custom error documents
-Ursprüngliche Nachricht- Von: Torsten Foertsch torsten.foert...@gmx.net Gesendet: 17.09.09 13:14:16 An: modperl@perl.apache.org CC: Andreas Mock andreas.m...@drumedar.de Betreff: Re: ModPerl::Registry and custom error documents On Thu 17 Sep 2009, Andreas Mock wrote: How can we dynamically create own error documents without using the lower level mod_perl/apache api? Is there a simple way? How can we achieve that? Then you can configure ErrorDocuments, e.g. ErrorDocument 404 http://huhu.com ErrorDocument 500 dumm gloffe Hi Torsten, hi all, ok, this seems to be the simple case. Thank you for this answer. Is there another way to create custom ErrorDocuments based on the return value of a ModPerl::Regisry script as long as the script has not printed to stdout yet? Best regards Andreas
ModPerl::Registry and custom error documents
Hi all, I searched and googled around for a while but couldn't find a solution for the following question. We're using ModPerl::Registry (PerlOptions +ParseHeaders) in combination with mod_perl to serve our pages in a CGI like environment. This has the advantage for us to have only a very very small layer of integration between the scripts an the special runtime environment. Now we want to serve custom made error documents and thought naively to get it work by just setting the status to the error code and serving a html-page as it works with a normal status 200 page. But this doesn't work. It seams that apache jumps right into the error handling stuff as soon as a status code = 400 is seen. How can we dynamically create own error documents without using the lower level mod_perl/apache api? Is there a simple way? Best regards Andreas Mock
ModPerl::Registry and custom error documents
Hi all, I searched and googled around for a while but couldn't find a solution for the following question. We're using ModPerl::Registry (PerlOptions +ParseHeaders) in combination with mod_perl to serve our pages in a CGI like environment. This has the advantage for us to have only a very very small layer of integration between the scripts an the special runtime environment. Now we want to serve custom made error documents and thought naively to get it work by just setting the status to the error code and serving a html-page as it works with a normal status 200 page. But this doesn't work. It seams that apache jumps right into the error handling stuff as soon as a status code = 400 is seen. How can we dynamically create own error documents without using the lower level mod_perl/apache api? Is there a simple way? How can we achieve that? Best regards Andreas Mock
Re: ModPerl::Registry and custom error documents
On Thu 17 Sep 2009, Andreas Mock wrote: How can we dynamically create own error documents without using the lower level mod_perl/apache api? Is there a simple way? How can we achieve that? A very simple registry script: #!/usr/bin/perl use strict; my $r=shift; $r-status($r-args); exit; Then you can configure ErrorDocuments, e.g. ErrorDocument 404 http://huhu.com ErrorDocument 500 dumm gloffe Now try it out: A 404 will be translated into a redirect: $ curl http://localhost/etest?404 -v * About to connect() to localhost port 80 (#0) * Trying ::1... connected * Connected to localhost (::1) port 80 (#0) GET /etest?404 HTTP/1.1 User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8h zlib/1.2.3 libidn/1.10 Host: localhost Accept: */* HTTP/1.1 302 Found Date: Thu, 17 Sep 2009 11:05:19 GMT Server: Apache/2.2.13 (Unix) proxy_html/3.0.1 mod_ssl/2.2.13 OpenSSL/0.9.8h DAV/2 SVN/1.6.4 mod_apreq2-20090110/2.7.1 mod_perl/2.0.5threading3 Perl/v5.10.0 Location: http://huhu.com Content-Length: 199 Content-Type: text/html; charset=iso-8859-1 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN htmlhead title302 Found/title /headbody h1Found/h1 pThe document has moved a href=http://huhu.com;here/a./p /body/html * Connection #0 to host localhost left intact * Closing connection #0 a 403 sends the normal error page $ curl http://localhost/etest?403 -v * About to connect() to localhost port 80 (#0) * Trying ::1... connected * Connected to localhost (::1) port 80 (#0) GET /etest?403 HTTP/1.1 User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8h zlib/1.2.3 libidn/1.10 Host: localhost Accept: */* HTTP/1.1 403 Forbidden Date: Thu, 17 Sep 2009 11:05:58 GMT Server: Apache/2.2.13 (Unix) proxy_html/3.0.1 mod_ssl/2.2.13 OpenSSL/0.9.8h DAV/2 SVN/1.6.4 mod_apreq2-20090110/2.7.1 mod_perl/2.0.5threading3 Perl/v5.10.0 Content-Length: 207 Content-Type: text/html; charset=iso-8859-1 !DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN htmlhead title403 Forbidden/title /headbody h1Forbidden/h1 pYou don't have permission to access /etest on this server./p /body/html * Connection #0 to host localhost left intact * Closing connection #0 and a 500 delivers a custom error message: $ curl http://localhost/etest?500 -v * About to connect() to localhost port 80 (#0) * Trying ::1... connected * Connected to localhost (::1) port 80 (#0) GET /etest?500 HTTP/1.1 User-Agent: curl/7.19.0 (x86_64-suse-linux-gnu) libcurl/7.19.0 OpenSSL/0.9.8h zlib/1.2.3 libidn/1.10 Host: localhost Accept: */* HTTP/1.1 500 Internal Server Error Date: Thu, 17 Sep 2009 11:09:19 GMT Server: Apache/2.2.13 (Unix) proxy_html/3.0.1 mod_ssl/2.2.13 OpenSSL/0.9.8h DAV/2 SVN/1.6.4 mod_apreq2-20090110/2.7.1 mod_perl/2.0.5threading3 Perl/v5.10.0 Content-Length: 11 Connection: close Content-Type: text/html; charset=iso-8859-1 * Closing connection #0 dumm gloffe Torsten -- Need professional mod_perl support? Just hire me: torsten.foert...@gmx.net