I am running apache 2.2.4 on Red Hat. I need to set 2 cookies, then redirect the request. The redirect is working, but the cookies are not being set. In order to debug this, I wrote a simple Perl CGI that sets 2 cookies, then redirects to another Perl CGI on the same server which reads all cookies. Here is the CGI that sets the cookies and performs the redirect (note: domain name changed to protect the innocent) my $query = new CGI; my $cookie1 = cookie( -name => 'ID', -value => "11498", -domain => "xxx.com", -path => '/'); my $cookie2 = cookie( -name => 'User', -value => "rec", -domain => "xxx.com", -path => '/'); $request_uri="http://c295.xxx.com/cgi-bin/ReadCookies"; print $query->header(-cookie=> [$cookie1, $cookie2]); print "<HTML><HEADER><META HTTP-EQUIV='refresh' CONTENT='0;URL=$request_uri'>";
The redirect occurs and this CGI reads all cookies, but the 2 cookies set above are never found: open(LOG, ">/tmp/logfile"); %cookies = fetch CGI::Cookie; foreach $c (keys(%cookies)) { print LOG "$cookies{$c}\n"; } print LOG "Cookies printed\n"; close LOG; --------------------------------- Never miss a thing. Make Yahoo your homepage.