Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Cookie CGI.pm Linux problem retrieving cookies

by Ovid (Cardinal)
on Nov 11, 2001 at 03:11 UTC ( #124616=note: print w/ replies, xml ) Need Help??


in reply to Cookie CGI.pm Linux problem retrieving cookies

We need much more information before we can begin to debug this. When someone says they moved a site and cookies have broken, there are a couple of things that usually occur. Here's some typical code (using CGI.pm) to create and set a cookie:

my $cookie = $q->cookie( -name => 'session', -value => '123456', -expires => '+1h', -path => '/cgi-bin/admin/', -domain => '.somehost.com', -secure => 1); print $q->header( -cookie => $cookie );

Here's what usually happens to screw that up.

  • The domain is different or you're using an IP address which causes the cookie to fail. The cookie will only be returned if the domain specified matches. If your cookie domain is '.host.com' and the site is 'www.host.com', the cookie will be returned. If the cookie domain is 'www.host.com' and the site is 'host.com', you will get no cookie.
  • The site gets reconfigured so that the path information is no longer the same. If /cgi-cin/admin/ is now /cgi-bin/management/ and that's the path specification, your cookies will not be returned.
  • The secure switch is set, but the site is no longer running on SSL. I recently had an administrative console break because we moved the site and someone forgot to get an SSL certificate, so they just turned off SSL. My site breaking was a Good Thing.

If this doesn't answer your question, post the code that sets the cookie and the code that retrieves the cookie, along with relevant path and domain info.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


Comment on Re: Cookie CGI.pm Linux problem retrieving cookies
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://124616]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-10-22 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls