From de33898b7363a78c2e0dcf114db59552e0672711 Mon Sep 17 00:00:00 2001 From: Yury Pikhtarev Date: Fri, 20 Jun 2025 15:06:08 +0400 Subject: [PATCH] fix(redirect): add no-cache headers to prevent browser caching of redirects - Implemented `send_no_cache_headers()` in the redirect function to ensure that browsers do not cache redirect responses, adhering to best practices for HTTP redirects. --- library/includes/functions.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/includes/functions.php b/library/includes/functions.php index 27c81ebe3..6398907c9 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -1437,6 +1437,9 @@ function redirect($url) $redirect_url = $server_protocol . $server_name . $server_port . $script_name . preg_replace('#^\/?(.*?)\/?$#', '/\1', $url); + // Send no-cache headers to prevent browsers from caching redirects + send_no_cache_headers(); + // Behave as per HTTP/1.1 spec for others header('Location: ' . $redirect_url, response_code: 301); exit;