user2360915
user2360915

Reputation: 1139

Unable to read a cookie from perl when set by a php webpage

I have 2 webpages under the same host. 1 in php and 1 in perl cgi.

The php page is setting a cookie "c" under a domain "d.com" and path "/".

In perl I am trying to read the value of the cookie "c".

I tried the following code :

use CGI;    
use CGI::Cookie;

my $query = new CGI;
print $query->header();
#... some more code ...
$thecookie = $query->cookie(-name=>'c', -domain=>"d.com", -path=>"/");
print $thecookie;

Any help/idea would be appreciated.

Thanks.

Upvotes: 1

Views: 124

Answers (1)

user2360915
user2360915

Reputation: 1139

For anyone that had this issue. The solution was simple.

The problem is that the cookie was set to "secure" which force the browser to send the cookie only over https.

Since the perl page was accessed via http, the browser was not returning the cookie. Simple as that.

Accessing the page via https fixed the issue.

Upvotes: 1

Related Questions