]> git.mxchange.org Git - friendica.git/commitdiff
Changes:
authorRoland Häder <roland@mxchange.org>
Tue, 13 Sep 2022 13:00:23 +0000 (15:00 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 17 Jan 2024 00:02:59 +0000 (01:02 +0100)
- added 3rd parameter to send Pragma/Cache-Control headers
- maybe there is a better one in some composer package?

src/Core/System.php

index df8cb9377e6bdd7f70ea61aae32d17e92e721866..8c39aecdb6db7c1adb7a51d37a340560ab46a8d9 100644 (file)
@@ -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) {