Skip to content
Advertisement

Php: Set header for cookie attribute SameSite=None;Secure is not working at all

I know there is many solutions given regarding the same question but I tried all of them and none of them working at all.

I am tried following ways but none of them worked. My php version is 7.1 and Codeigniter framework I am using.

By setting header in index.php

header('Set-Cookie: HttpOnly; SameSite=None;Secure');

By setting in .htaccess

Header edit Set-Cookie ^(.*)$ "$1;HttpOnly;Secure;SameSite=none"

By setting in apache2 httpd.conf

Header edit Set-Cookie ^(.*)$ "$1;HttpOnly;Secure;SameSite=None"

I have reviewed Chrmoe git updates, it says header('Set-Cookie: cross-site-cookie=bar; SameSite=None; Secure');

I didn’t get the option cross-site-cookie=bar. What will be value for it.

I also tried the same one but it didn’t work at all.

Advertisement

Answer

Hello I have solved this issue by following. Hope it will help to others

In httpd.conf (For bitnami server file will be /opt/bitnami/apache2/conf)

Header always edit Set-Cookie ^(.*)$ $1;Secure;SameSite=None
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement