]> 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>
Mon, 23 Jun 2025 20:53:14 +0000 (22:53 +0200)
- added 3rd parameter to send Pragma/Cache-Control headers
- maybe there is a better one in some composer package?

src/Core/System.php

index d7367e871c2503c57e802698598620ef650a78dc..19a6b42fa3b5461464ed4306903ba1ec171b10f4 100644 (file)
@@ -506,22 +506,29 @@ 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
         *
         * @return never
         */
-       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))) {
                        DI::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) {