Ideally, the cookie set by a request (be it an image or html) originally sent to Site A should always be returned to any future request to Site A. However, browsers now-a-days allow users to turn off third party cookies - which may throw away any cookies from/to your core site. Are you seeing this all the time with your own browser or is this just from some users? Also make sure the 'path' on the cookie isn't pointing to some sub-section which isn't refered in the image's URL. Also the fully-qualified hostname used for original cookie matters. something.com, www.something.com, 1.2.3.4 IP etc are all different from cookie's point of view.
Best thing to do: Turn on "Ask me" option for cookie handling on your browser and see if the cookie is being set with all the right properties. You will get some kind of dialog/details where you can see the cookie contents while you are doing your tests. -- Hari On Tue, Oct 14, 2003 at 11:06:50AM -0700, Tofu Optimist wrote: > Hi -- I have a site which mananges photos for > visitors. I log cookies to a log file using the > recipe from > http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler. > > Here's the code > > package CookLog; > use strict; > use warnings; > use Fcntl qw(:flock); > sub handler { > my $r = shift; > my $entry = sprintf(qq(%s|%s|%s|%s|%s\n), > $r->connection->remote_ip, > scalar(time), > $r->status, > $ENV{'HTTP_COOKIE'} || '-', > $r->uri); > my $logfile = > Apache::server_root_relative($r->pool, > "logs/mycookies_log"); > open my $fh, ">>$logfile" or die "can't open > $logfile: $!"; > flock $fh, LOCK_EX; > print $fh $entry; > close $fh; > return &Apache::OK; > } > > > This code works fine for visitors on the core site. > > When a visitor is on a different site (sister site, > different domain) views an image back on the core site > (the sister site uses an image tag pointing back to > the core site), a cookie (if any) from the core site > is not detected and logged. > > Is the problem with how I am obtaining the cookie from > the environment? Or is the problem some apache > setting? Or is the problem that I am misunderstanding > how cookies are sent? If the last, is there a way for > a request (say, an image) to server of site "A" off a > site "B" page to return the site "A" cookies to site > "A"? > > Thanks > > -TO > > __________________________________ > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search > http://shopping.yahoo.com