From babc2033be1e2eb18049b72cb8994c84c8fc4e23 Mon Sep 17 00:00:00 2001 From: "Nathan J. Brauer" Date: Sun, 15 Oct 2023 17:50:19 -0700 Subject: [PATCH] Fixes internal infinite recursion on Nginx/PHP-FPM environments --- src/Controllers/ShareDraftController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Controllers/ShareDraftController.php b/src/Controllers/ShareDraftController.php index 3ea1914..a706af1 100644 --- a/src/Controllers/ShareDraftController.php +++ b/src/Controllers/ShareDraftController.php @@ -177,6 +177,11 @@ private function getRenderedPageByURL(string $url): HTTPResponse Environment::setVariables($variables); + // This extra step required for PHP-FPM/Nginx implementations + Environment::setEnv('REQUEST_URI', $url); + Environment::setEnv('REQUEST_METHOD', 'GET'); + Environment::setEnv('HTTP_USER_AGENT', $variables['_SERVER']['HTTP_USER_AGENT']); + // Health-check prior to creating environment $pageRequest = HTTPRequestBuilder::createFromVariables($variables, @file_get_contents('php://input'));