In Chrome 80 and above, the same-site policy will be enabled by default
Samesite has the following values
Lax: Only requests from the same origin and top-level domain can carry cookies (equivalent to same-site)
Strict: Only requests from same origin can carry cookies (equivalent to same-origin)
None: No restrictions on the use of cookies, Just use
Solve cross-domain issues:
If you need to send cookies across domains, please use the None enumeration value to select no SameSite restriction. The None command needs to be used with the Secure command
Tip: The None enumeration value is a standard new enumeration value. Some old browsers do not recognize this enumeration value. Cause some problems.
PHP records cookie changes, do not use the setcookie method, directly use the header method to splice cookies:
It must be HTTPS request, the splice must meet cookie text format, for example, the following
record specified expiration time in the cookie value * .sina.net domain
header ( “Set-Cookie: key = value; Expires = expiration time; path = /; domain=.sina.net; SameSite=None; Secure”);
if (strpos($_SERVER[ ' HTTP_USER_AGENT ' ], ' Chrome/8 ' ) !== false ) { $expireTime =gmdate( " D, d MYH:i:s " , time()+SID_COOKIE_EXPIRE). " GMT " ; header( " Set-Cookie: SID= " .$mailSid. " ; expires= " .$expireTime. " ; path=/; domain=.sina.net; SameSite=None; Secure " ); Secure " ); }
Read More:
- [Solved] has been blocked by CORS policy: Response to preflight request doesn‘t pass access control check: No
- [PHP] Solve the 500 error problem-nginx and fpm have no error logs
- Vant configures multiple sites, and new sites 404 error [How to Solve]
- Fatal error: Function name must be a string in
- How to solve Magento 500 internal server errors
- PHP solves the problem that composer exceeds the memory size Allowed memory size
- PHP curl error: SSL certificate problem: unable to get local issuer certificate settlement program
- How to Solve phpExcel Error: ERR_INVALID_RESPONSE
- [Solved] cURL error 60: SSL certificate problem: unable to get local issuer certificate
- How to Solve PHP Fatal error: Namespace declaration statement has to be the very first statement
- Laravel-admin php artisan admin:install error reporting problem solution
- How to Solve opcache error: zend_mm_heap corrupted
- [Solved] iis cURL error 60: SSL certificate problem: unable to get local issuer certificate
- [PHP] Solve Call-time pass-by-reference has been removed
- [PHP] Solve PHP Call to undefined function ldap_connect()
- How to Solve PHP Error: no package’oniguruma’ found
- [PHP] Solve the limitation of uploading files in nginx php 413 Request Entity Too Large
- PHP: How to parse MHT file into HTML
- ThinkPHP interface cross domain request error [Solved]
- [Solved] PHP Error: Warning: file_get_contents(): Failed to enable crypto