fix: switch API routing to query string for Nginx compatibility
This commit is contained in:
@@ -19,14 +19,8 @@ final class Request
|
||||
{
|
||||
$this->method = $_SERVER['REQUEST_METHOD'];
|
||||
|
||||
// Normalize path: extract /api/v1/... portion from any subdirectory structure
|
||||
$rawPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$apiPos = strpos($rawPath, '/api/v1/');
|
||||
if ($apiPos !== false) {
|
||||
$this->path = substr($rawPath, $apiPos); // e.g. /api/v1/auth/login
|
||||
} else {
|
||||
$this->path = $rawPath;
|
||||
}
|
||||
// Read API path from query string: index.php?route=/api/v1/auth/login
|
||||
$this->path = $_GET['route'] ?? parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$this->headers = getallheaders();
|
||||
$this->queryParams = $_GET;
|
||||
$this->files = $_FILES;
|
||||
|
||||
Reference in New Issue
Block a user