Differences between Apache and Nginx (From Brasil)

Hi guys;

I´m using a basic slim api V4; in apache server, i can read header, BUT in Nginx, i can´t; what i have to do to work in Nginx, please?

$app = AppFactory::create();
$app->addBodyParsingMiddleware();
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$app->get($rootRoute . ‘v1/smallroomlist/’, RoomList::class . ‘:getSmallRoomList’);

In RoomList controller:

public function getSmallRoomList(Request $request, Response $response, array $args): Response
{
    var_dump($_SERVER);        << goes empty in Ngnix, but full in Apache
    
    $token = '';
    $headers = $request->getHeaders();  <- always empty in Nginx...

    foreach ($headers as $name => $values) {
        if ($name == 'X-Auth-IApi-Token') {
            $token = $values[0]; 
        }
        if ($name == 'X-AUTH-IAPI-TOKEN') {
            $token = $values[0];
        }            
    }

I read about headers in slim webiste, but in Nginx, headers allways be empty,.

Tanks;

Problem solved; Nginx configurations were blocking the API. Only the autoloading of classes still doesn’t work on Nginx despite working on Apache.

1 Like

Can you share what configurations were generating the issue and how did you solve it? For posterity