Error receiving header on PHP server sent via http request

2

I'll be needing your help.

My restfull client application is sending a header called 'Auth' with an authentication token for the PHP server. When I do the tests with a server running on localhost everything works fine. However, when I put the same code on the Localweb server it does not work, I can not retrieve the header, the code below always falls on the else as if I was not sending the header.

 function authenticateApp() {
    $headers =   apache_request_headers();

    if (isset($headers["Authorization"])) {
     //Se o header foi existe faz os teste de autenticação;
    } else {

        //Se não foi passado retorna um código de erro
       //No localhost funciona, no servidor da Localweb sempre cai aqui.   


    }
}

Note that both on localhost and localweb I'm using PHP version 5.6. My local machine is Windows and the server is Linux, does it have something to do?

    
asked by anonymous 21.11.2015 / 08:22

1 answer

0

Problem solved. When I gave a print_r to the variable and did some more tests I realized that the problem only occurred when I named the header as "Authorization" it did not appear in the list of headers, I changed the name and I had no problem.

function authenticateApp() {
$headers =   apache_request_headers();

if (isset($headers["novo_nome"])) {
 //Bastou renomear o header
} else {

    //Se não foi passado retorna um código de erro

}

}

    
21.11.2015 / 12:41