On Thu, 8 Feb 2001, Robert Landrum wrote:

> The problem is that Apache does not put the "Set-Cookie" before the
> "Location" when generating headers.  To fix this, you need to build
> the header yourself.  I've found that this works with Netscape and
> IE, but with IE, the place where you redirect to does not have access
> to the cookie that you just set.  All subsequent pages are able to
> read the cookie... It's a bug in IE.
>
>
>      my $cookie = Apache::Cookie->new($r,
>          -name => "MYCOOKIE",
>          -value => "VALUE",
>          -path => "/some/cookie/path"
>      );
>
>      my %headers = (
>          "Location" => "/some/redirect/location",

I'd like to mention that the Location header MUST be absolute, NEVER
relative.  Absolute means that it must include the scheme!

http://www.w3.org/Protocols/rfc2068/rfc2068

14.30 Location

   The Location response-header field is used to redirect the recipient
   to a location other than the Request-URI for completion of the
   request or identification of a new resource. For 201 (Created)
   responses, the Location is that of the new resource which was created
   by the request.  For 3xx responses, the location SHOULD indicate the
   server's preferred URL for automatic redirection to the resource. The
   field value consists of a single absolute URL.

          Location       = "Location" ":" absoluteURI

   An example is

          Location: http://www.w3.org/pub/WWW/People.html


-jwb

Reply via email to