How to set SameSite=None header in php

Highlighted
Shopify Partner
9 0 1

Hello All,

 

I got notification from Shopify regarding chrome update for SameSite attribute. 

 

I have created an app on php- Codeigniter framework. I am tried following ways but none of them worked. My php version is 7.1

 

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 also tried the same one but it didn't work at all. Can you please help me. It is urgent.

Highlighted
New Member
2 0 0

UPDATE
Found this thread and it resolve the issue.

https://community.shopify.com/c/Shopify-APIs-SDKs/SameSite-Cookie-via-htaccess-file/m-p/644341/highlight/false#M43673 


Have you already fixed it? We have the same problem. My application no longer work inside the iframe. The issue is when inside the iframe the session no longer works via ajax call. 
I tired to add header.  

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

 I'm stuck  fixing this issue :( my last option would be open the application outside the shopify.

#PHP
#Codeigniter

0 Likes
Highlighted
Shopify Partner
9 0 1

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

 

Hope this will help you 

0 Likes
Highlighted
Shopify Partner
375 46 75

Hi @dhara-pawar 
what about Incompatible browser? I think this is supported only in chrome 80+
will it affect to other browsers? how did you managed it?

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/checkout-reminder
0 Likes