From a5c89bc48e68841f9bcdc4aaba746cf67ccbff65 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 8 Sep 2014 22:02:45 +0200 Subject: [PATCH] Improved avatar loading speed --- src/Controllers/UserAvatarController.php | 2 +- src/Helpers/HttpHelper.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Controllers/UserAvatarController.php b/src/Controllers/UserAvatarController.php index e5e5877a..c74cc02b 100644 --- a/src/Controllers/UserAvatarController.php +++ b/src/Controllers/UserAvatarController.php @@ -53,7 +53,7 @@ final class UserAvatarController extends AbstractController private function serveFromUrl($url) { - $this->httpHelper->nonCachedRedirect($url); + $this->httpHelper->redirect($url); } private function serveFromFile($file, $size) diff --git a/src/Helpers/HttpHelper.php b/src/Helpers/HttpHelper.php index ccdeeda7..1793c726 100644 --- a/src/Helpers/HttpHelper.php +++ b/src/Helpers/HttpHelper.php @@ -46,6 +46,12 @@ class HttpHelper return $requestUri; } + public function redirect($destination) + { + $this->setResponseCode(307); + $this->setHeader('Location', $destination); + } + public function nonCachedRedirect($destination) { $this->setResponseCode(303);