Discussion:
[fpc-pascal] How to get the "Authorization" header in CGI/FastCGI?
silvioprog
2014-04-18 20:44:18 UTC
Permalink
Hello,

In PHP it is very easy:

<?php
$headers = apache_request_headers();
echo $headers['Authorization'];
?>

But I tried in CGI, and the "Authorization" header isn't returned in any
property, even in environment variables.

Can I get this header using CGI and/or FastCGI?

Thank you!
--
Silvio Clécio
My public projects - github.com/silvioprog
silvioprog
2014-04-18 22:11:07 UTC
Permalink
Post by silvioprog
Hello,
<?php
$headers = apache_request_headers();
echo $headers['Authorization'];
?>
But I tried in CGI, and the "Authorization" header isn't returned in any
property, even in environment variables.
Can I get this header using CGI and/or FastCGI?
Thank you!
Following this steps:

http://stackoverflow.com/questions/17488656/zend-server-windows-authorization-header-is-not-passed-to-php-script

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1


With:

procedure TReqTokenAction.Post;
begin
Write(TheRequest.Authorization);
end;

And it worked fine! :)
--
Silvio Clécio
My public projects - github.com/silvioprog
Loading...