Sending Cookies in REDIRECT Response

Submitted by:Jhon Smith

Date added:08 June, 2011

Category:Apache

You should use err_headers_out() and not headers_out() when you want to send cookies in the REDIRECT response.

Tags: redirect response

Code Snippet:

  use Apache::Constants qw(REDIRECT OK);
my $r = shift;
# prepare the cookie in $cookie
$r->err_headers_out->add('Set-Cookie' => $cookie);
$r->headers_out->set(Location => $location);
$r->status(REDIRECT);
$r->send_http_header;
return OK;
 
 

Comments