I’m running Symfony 3.4 LTS and I have an issue when I try to use NTLM authentification.
For the record, on my server I get :
- a wordpress website
- a TYPO3 website
- and my new SYMFONY website
The WordPress and Typo3 use NTLM authentification with :
<?php
$headers = apache_request_headers();
// then $headers['Authorization'] contains a big string with all the needed datas
?>
.. but I can’t use this script on Symfony because there is no Authorization header return by the apache_request_headers()
function. I made some searches in Stack Overflow but nothing helped me to fix my issue.
I tried :
-
Add new directives in my htaccess :
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
.. and alsoSetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
-
Work with $_SERVER[‘AUTH_USER’] (this var is missing)
- Use a bundle (the only one I found only runs on Symfony 2.x)
- Use the Request with
$request->headers->all()
but theAuthorization
parameter is still missing
Do you have any idea ?
By the way, I don’t want to edit my vhost file because my 2 other websites work well.
2
Answers
I found a solution. In my code, I added :
.. right after the
apache_request_headers()
function. Now I got access to theAuthorization
header.I guess you are using php-fpm and not mod_php.
Are you missung this:
in your apache config before the FPM handler?