mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
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.
This commit is contained in:
parent
d40c6ba68f
commit
de33898b73
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue