From ca91812233e4a171f3142c2d52bc4b26c9dca742 Mon Sep 17 00:00:00 2001
From: Dominik Pfennig <dominik@suma-ev.de>
Date: Fri, 26 Jan 2018 10:11:27 +0100
Subject: [PATCH] =?UTF-8?q?Relative=20Links=20aus=20einem=20Redirect=20wer?=
 =?UTF-8?q?den=20nun=20korrekt=20aufgel=C3=B6st?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/Http/Controllers/ProxyController.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/Http/Controllers/ProxyController.php b/app/Http/Controllers/ProxyController.php
index 9207fdb..ab4ebca 100644
--- a/app/Http/Controllers/ProxyController.php
+++ b/app/Http/Controllers/ProxyController.php
@@ -325,7 +325,12 @@ class ProxyController extends Controller
                         } elseif (!$withCookies && strtolower($ar[0]) === "content-type") {
                             $headerArray[strtolower(trim($ar[0]))] = strtolower(trim($ar[1]));
                         } elseif (strtolower($ar[0]) === "location") {
-                            $headerArray[trim($ar[0])] = $this->proxifyUrl(trim($ar[1]), null, false);
+                            $redLink = $ar[1];
+                            if(strpos($redLink, "/") === 0){
+                                $parse = parse_url($url);
+                                $redLink = $parse["scheme"] . "://" . $parse["host"] . $redLink;
+                            }
+                            $headerArray[trim($ar[0])] = $this->proxifyUrl($redLink, null, false);
                         } elseif (strtolower($ar[0]) === "content-disposition") {
                             $headerArray[strtolower(trim($ar[0]))] = strtolower(trim($ar[1]));
                         } else {
-- 
GitLab