logo

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ
No Result
View All Result
logo
No Result
View All Result
Trang chủ samesite cookies

Samesite cookies

by Admin _ October 22, 2022
I recently read "RFC 6265" on the attribute "Same Site", I looked at some articles that talked about that in April 2016, "same-site" attribute has been implemented for Chrome 51 & Opera 39 ...

I wonder if current PHP supports creating cookies with this attribute?

Reference:


Bạn đang xem: Samesite cookies

*

Xem thêm:

*

Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

1. For PHP >= v7.3

You can use the $options array to set the samesite value, for example:

setcookie($name, $value, < "expires" => time() + 86400, "path" => "/", "domain" => "domain.example", "secure" => true, "httponly" => true, "samesite" => "None",>);The value of the samesite element should be either None, Lax or Strict.

Read more in the manual page.

2. For PHP Header always edit Set-Cookie (.*) "$1; SameSite=Lax"and this will update all your cookies with SameSite=Lax flag

See more here: https://blog.giantgeek.com/?p=1872

2.2 Setting SameSite cookies using Nginx configuration

location / # your usual config ... # hack, phối all cookies lớn secure, httponly and samesite (strict or lax) proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";Same here, this also will update all your cookies with SameSite=Lax flag

See more here: https://serverfault.com/questions/849888/add-samesite-to-cookies-using-nginx-as-reverse-proxy

2.3 Setting SameSite cookies using header method

As we know cookies are just a header in HTTP request with the following structure

Set-Cookie: key=value; path=/; domain=example.org; HttpOnly; SameSite=Laxso we can just mix the cookies with header method

header("Set-Cookie: key=value; path=/; domain=example.org; HttpOnly; SameSite=Lax");In fact, Symfony is not waiting for PHP 7.3 and already doing it under the hood, see here

Share Tweet Linkedin Pinterest
Previous Post

Thực thi câu lệnh delete với form trong php

Next Post

Php array push empty array code example

CÙNG CHUYÊN MỤC

fantastic blog (cms) in php with source code

Fantastic blog (cms) in php with source code

28/04/2021
php shopping cart tutorial using sessions

Php shopping cart tutorial using sessions

28/04/2021
các câu hỏi phỏng vấn php laravel

Các câu hỏi phỏng vấn php laravel

28/04/2021
lập trình php trên visual studio

Lập trình php trên visual studio

28/04/2021
installing apache php mysql on ubuntu 18

Installing apache php mysql on ubuntu 18

20/01/2023
tính kế thừa trong oop php

Tính kế thừa trong oop php

20/01/2023
how to check if a string contains a specific word in php

How to check if a string contains a specific word in php

16/01/2023
virtualmin centos with multiple php

Virtualmin centos with multiple php

16/01/2023

Newsletter

The most important automotive news and events of the day

We won't spam you. Pinky swear.

Chuyên Mục

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ

News Post

  • Cách làm nước gạo lứt lợi sữa

About

Chúng tôi tạo ra trang web nhằm mục đích mang lại kiến thức bổ ích cho cộng đồng, các bài viết được sưu tầm từ nhiều nguồn trên internet giúp mang lại kiến thức khách quan dành cho bạn

©2023 darkedeneurope.com - Website WordPress vì mục đích cộng đồng

Liên Hệ - Giới Thiệu - Nội Quy - Bảo Mật

No Result
View All Result
  • Trang chủ
  • Chuyên mục
    • Hỏi Đáp
    • Kiến Thức
    • Sức Khỏe
    • Tử Vi
    • Công Nghệ
  • Lưu trữ
  • Liên hệ

© 2023 darkedeneurope.com - Website WordPress vì mục đích cộng đồng.