Jump to content
The Uniform Server Community

Ques: Why dont my cookies work?

Recommended Posts

Hi All,

I am having some major problems using cookies. Whilst developing the site on localhost I had no problems.

I have configured my firewall to forward http traffic from a public IP to my machine and cookies just will not work.

I have created a simple test page which consist of this:


$value = 'something from somewhere';

setcookie("TestCookie", $value, time() + 3600);

// Print an individual cookie
echo $_COOKIE["TestCookie"] . "<br>";
echo $HTTP_COOKIE_VARS["TestCookie"] . "<br>";

// Another way to debug/test is to view all cookies
echo "<pre>"; print_r($_COOKIE); echo "</pre>";

But no cookie is created.

Can anybody tell me why? Is it related to my firewall?

Share this post

Link to post
Share on other sites

Nah its not that. It's doing this in Firefox as well.

I have been monitoring the HTTP headers sent to/from the server and I can see the request to create a cookie and the client is sending it back in the header.

I have just noticed however that there is something funny in $_SERVER.

When accessed through localhost it looks like this

 string(15) "test=test+value"

When accessed from the Internet i get this

 string(15) "test=test+value"


What is XOOKIE and why is the data sent there?

Share this post

Link to post
Share on other sites

I have solved the problem.

Our firewall uses something called Protection Profiles (its a FortiGate) that was deforming the cookie part of the packet.

I removed the option to block cookies and everything is A-OK. :P

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...