Safari not sending cookie even after setting SameSite=None; Secure

Versions of Safari on MacOS 10.14 and all browsers on iOS 12 are affected by this bug which means that SameSite=None is erroneously treated as SameSite=Strict, e.g. the most restrictive setting. I’ve published some guidance in SameSite cookie recipes on either: Using two sets of cookies to account for browsers that support SameSite=None; Secure and … Read more

Domain set cookie for subdomain

No. Besides that fuu.example.com is an invalid Domain value (it must start with a ., i.e. .fuu.example.com) (see update below) the cookie would get rejected: To prevent possible security or privacy violations, a user agent rejects a cookie (shall not store its information) if any of the following is true: The request-host is a Fully-Qualifed … Read more

setcookie() does not set cookie in Google Chrome

Disabling cookies for IP addresses and localhost was a design decision. See also: https://code.google.com/p/chromium/issues/detail?id=56211 Ways to work around the issue include: Set a local domain (e.g., edit /etc/hosts to use 127.0.0.1 localhost.com). Use http://myproject.localhacks.com/ (which points to 127.0.0.1). Use an empty domain value when setting the cookie. For example, in PHP: setcookie( $AUTH_COOKIE_NAME, $cookie_value, time() … Read more

How can I send cookies using PHP curl in addition to CURLOPT_COOKIEFILE?

If the cookie is generated from script, then you can send the cookie manually along with the cookie from the file(using cookie-file option). For example: # sending manually set cookie curl_setopt($ch, CURLOPT_HTTPHEADER, array(“Cookie: test=cookie”)); # sending cookies from file curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile); In this case curl will send your defined cookie along with the cookies … Read more

Cookies on localhost with explicit domain

By design, domain names must have at least two dots; otherwise the browser will consider them invalid. (See reference on http://curl.haxx.se/rfc/cookie_spec.html) When working on localhost, the cookie domain must be omitted entirely. You should not set it to “” or NULL or FALSE instead of “localhost”. It is not enough. For PHP, see comments on … Read more