fix(redirect): add no-cache headers to prevent browser caching of redirects

This commit is contained in:
Roman Kelesidis 2025-06-26 13:07:15 +03:00
commit 9c45351880
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4

View file

@ -1450,6 +1450,9 @@ function redirect($url)
$redirect_url = $server_protocol . $server_name . $server_port . $script_name . preg_replace('#^\/?(.*?)\/?$#', '/\1', $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 // Behave as per HTTP/1.1 spec for others
header('Location: ' . $redirect_url, response_code: 301); header('Location: ' . $redirect_url, response_code: 301);
exit; exit;