Skip to content

Commit

Permalink
Merge pull request GEWIS#1868 from tomudding/fix/index-php-directly-u…
Browse files Browse the repository at this point in the history
…sable-in-routing

fix: index.php being directly usable in routing
  • Loading branch information
tomudding authored Jul 21, 2024
2 parents ccbd9ae + 86b19b2 commit 85c3ea9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions module/Application/src/Router/LanguageAwareTreeRouteStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public function match(
// Store the original base URL (likely only just set above).
$oldBaseUrl = $this->getBaseUrl();

// Do not allow direct access using /index.php. It is too difficult to properly configure this in NGINX, as we
// want to keep using the Laminas-generated 404 page and not a generic NGINX 404 page.
if (str_starts_with($oldBaseUrl, '/index.php')) {
return null;
}

// Get the path from the URI, strip the base from it, and finally split it on `/`s.
$uri = $request->getUri();
$strippedPath = ltrim(
Expand Down

0 comments on commit 85c3ea9

Please sign in to comment.