From 297ba93508bac14b502bc1ec7791c64eb80ac13a Mon Sep 17 00:00:00 2001 From: Remo Zaros Date: Thu, 25 Jun 2026 11:01:11 +0200 Subject: [PATCH] Change sercure when http or https is used --- pppr_cookie.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pppr_cookie.php b/pppr_cookie.php index 48c233f..d35c7d2 100644 --- a/pppr_cookie.php +++ b/pppr_cookie.php @@ -40,11 +40,13 @@ function set_pppr_cookie($is_local, $street_name, $house_number, $postcode, $cit $signature = hash_hmac('sha256', $data_string, WP_PPPR_SALT); $cookie_value = $data_string . "|" . $signature; + $is_secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); + setcookie("PPPR", $cookie_value, [ 'expires' => time() + 7200, 'path' => '/', 'domain' => $_SERVER['SERVER_NAME'], - 'secure' => true, // Only send over HTTPS + 'secure' => $is_secure, // Only send over HTTPS 'httponly' => true, // Prevent JavaScript access 'samesite' => 'Lax' // Protect against CSRF ]);