You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rolf Kamp <yr...@yahoo.com> on 2008/02/27 19:27:43 UTC
[users@httpd] Cookies in Apache
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.
Re: [users@httpd] Cookies in Apache
Posted by Nils Jeppe <ni...@pandemonium.de>.
Hi Rolf,
On Wed, 27 Feb 2008, Rolf Kamp wrote:
> 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
Don't have an immediate solution, and really do not want to debug your cgi
(I am perl-illiterate) :p But: Did you check whether the set cookie
headers actually arrive on the client side? If not: Are you behind a
reverse proxy with ProxyErrorOverride set?
Best wishes
Nils
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org