Skip to content

Commit

Permalink
Merge pull request #212 from nathanbrauer/bugfix/infinite-loops-option-b
Browse files Browse the repository at this point in the history
Fixes #213: Nginx/PHP-FSM environments subject to infinite recursions (internal redirects) - Option B
  • Loading branch information
GuySartorelli authored Dec 19, 2023
2 parents 46da869 + 58a795e commit 2095c3e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Controllers/ShareDraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,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'));

Expand Down

0 comments on commit 2095c3e

Please sign in to comment.