SameSite Cookie Problem

Google Chrome, firefox ve diğer tarayıcılarında yapılan güncelleme ile sameSite=None ve secure olarak tanımlanmamış cookiler varsayılan olarak sameSite=Lax(first-party cookie) olarak kabul edilecektir.
Bu first-party cookieleri bağlı olduğu hosting üzerinden işlem yapacağı ve site içindeki birlikte çalışan sitelerin veri alışverişini keseceği anlamına gelmektedir.
Sitenize cross-site request yani sitenizin bir başka siteden veri çekmesi durumunda browser üzerinde cookie erişimi güvenlik sebebiyle kısıtlanmaktadır.

Tarayıcınızın adres satırına chrome://flags yazıp bu ayarların aktif olup olmadığını kontrol edin.






In this case, you can solve the samesite cookie problem with some code changes.

PHP 7.3 and above same site cookie solution

setcookie('same-site-cookie', 'foo', ['samesite' => 'Lax']);
setcookie('cross-site-cookie', 'bar', ['samesite' => 'None', 'secure' => true]);


Same site cookie solution PHP 7.3 and earlier

header('Set-Cookie: same-site-cookie=foo; SameSite=Lax');
header('Set-Cookie: cross-site-cookie=bar; SameSite=None; Secure');

You can use this code when you have header problems or want to use script code. Especially php 7 can be used for sime site cookie problem in previous versions.

<!--
var d = new Date();
d.setTime(d.getTime() + (30*24*60*60*1000)); //keep cookie 30 days
var expires = "expires=" + d.toGMTString();         
document.cookie = "PHPSESSID" + "=;" + expires + ";path=/;SameSite=None;Secure"; //can set SameSite=Lax also*/
-->
Your configuration may affect cookie settings. The same site problem, which is a problem in some bank integrations due to the fact that the payment is received but not received, damages the 3D protocol.
E.Albayrak

0 Yorum

Soru & Yorum


Web Tasarım

Renkli Kare

Web Tasarım Ajansı