From aae787fa8063ef179047800f7ee76da8f15136fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 13 Sep 2022 15:00:23 +0200 Subject: [PATCH] Changes: - added 3rd parameter to send Pragma/Cache-Control headers - maybe there is a better one in some composer package? --- src/Core/System.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Core/System.php b/src/Core/System.php index df8cb9377e..8c39aecdb6 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -514,20 +514,27 @@ class System * * @param string $url The new Location to redirect * @param int $code The redirection code, which is used (Default is 302) + * @param bool $proxy_headers Whether proxy-related headers are being sent * + * @return void * @throws FoundException * @throws MovedPermanentlyException * @throws TemporaryRedirectException - * * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function externalRedirect($url, $code = 302) + public static function externalRedirect(string $url, int $code = 302, bool $proxy_headers = false) { if (empty(parse_url($url, PHP_URL_SCHEME))) { Logger::warning('No fully qualified URL provided', ['url' => $url]); DI::baseUrl()->redirect($url); } + if ($proxy_headers) { + // Send Pragma/Cache-Control headers + header('Pragma: no-cache'); + header('Cache-Control: no-cache, must-revalidate'); + } + header("Location: $url"); switch ($code) { -- 2.39.5