--- Eric Cholet <[EMAIL PROTECTED]> wrote:
> > Hello, all.
> >
> > First, the problem:
> > ________________________________________
> > [Tue Jun 20 09:06:55 2000] [error] [client 90.17.209.65] Invalid
> error redirection directive: üØ@
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > üØ@? Let me assure you, "üØ@" isn't in my code anywhere. =o)
> >
> > I am, however, using a PerlPostReadRequestHandler that currently
> looks
> > much like this:
> > ________________________________________
> >
> > package Apache::PortCorrect;
> >
> > use strict;
> > use Apache::Constants qw( :response :methods );
> > use Carp ();
> > $SIG{__WARN__} = \&Carp::cluck;
> >
> > sub handler {
> >      my($r,$s,$url,$args,$uri,$subr);
> >      $r = shift;   # the request object
> >      return OK if 443 == $r->get_server_port;
> >      (undef,$url,undef) = split(/\s+/o, $r->the_request);
> >      return OK if $url =~ m{ ^(?:/ # doc root
> >                        | /(list|of|ok|dirs)/.* # edited
> >                        | /(page|list)[.]shtml  # ditto
> >                        | .*[.](gif|jpg)
> >                                )$
> >                        }ixo;
> >      $uri = "https://our.intranet.com" . $url; # again
> >      $args = $r->args;
> >      $uri .= "?$args" if $args;
> >      $r->custom_response(MOVED,$uri);
> >      return MOVED;
> > }
> >
> > 1; # guarantee return code for load
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Am I confusing or crosswiring Apache by doing a cross-port custom
> > response here?  It seems to work....
> >
> > Or is it something entirely different?
> 
> I don't think you can want custom_response here, it does an internal
> redirect. You want to do an external redirect, so use
> $r->header_out(location => ...)
> 
> --
> Eric

But doesn't an internal redirect go ahead and try to serve the page?

The MOVED return tells the server to tell the browser where it *should*
have gone, which effectively does the external redirect.

The above responds with:
~~~~~~~~~~~~~~~~~~~~~
HTTP/1.1 302 Found
Date: Tue, 20 Jun 2000 18:17:14 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.23 mod_ssl/2.6.4 OpenSSL/0.9.5a
Location: https://buda.bst.bls.com/dres/dres.cgi
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

159
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>302 Found</TITLE>
</HEAD><BODY>
<H1>Found</H1>
The document has moved <A
HREF="https://buda.bst.bls.com/dres/dres.cgi">here</A>.<P>
<HR>
<ADDRESS>Apache/1.3.12 Server at <A
HREF="mailto:[EMAIL PROTECTED]">buda.bst.bls.com</A>
Port 80</ADDRESS>
</BODY></HTML>

0

_______________________________________________
(Provided courtesy of a TELNET to the server.)

The browser never displays the page, because of the Location: header
the server is spitting out for the MOVED return.

__________________________________________________
Do You Yahoo!?
Send instant messages with Yahoo! Messenger.
http://im.yahoo.com/

Reply via email to