jgauthier Posted December 2, 2013 Share Posted December 2, 2013 (edited) I have a PHP application behind apache. Apache was using NTML authentication and serving the page from the local host. I've changed things around, and moved the authentication to an external apache server using SAML2. The new apache system is also functioning as a reverse proxy for the application. Once I got all the auth pieces working, but my app complains there is no user being passed. Interesting. So, I whip up this simple page: <?php phpinfo(); foreach (getallheaders() as $name => $value) { echo "$name: $value\n"; } print "User name: \"".$_SERVER["REMOTE_USER"]."\""; ?> phpinfo() and the foreach both reveal that HTTP_USER is being set. However, the explicit call for REMOTE_USER comes up blank! The application is open source, so I can see they are calling $_SERVER["REMOTE_USER"]. I have another application that is closed source, but exhibits the same symptoms. It shows me the variables, but the authorization mechanism cannot seem to process the user. This very well may not be a PHP issue at all, but since I can reproduce it within PHP, I figured I would start here to dig deeper into how this works, and where the fault may be. Thanks! Edited December 2, 2013 by jgauthier Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/ Share on other sites More sharing options...
dalecosp Posted December 2, 2013 Share Posted December 2, 2013 Does $_SERVER['REDIRECT_REMOTE_USER'] get populated? Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1460996 Share on other sites More sharing options...
jgauthier Posted December 2, 2013 Author Share Posted December 2, 2013 (edited) I don't see any reference to it in the output. But I can add it in httpd.conf: RequestHeader set REDIRECT_REMOTE_USER %{REMOTE_USER}s Edited December 2, 2013 by jgauthier Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461001 Share on other sites More sharing options...
requinix Posted December 2, 2013 Share Posted December 2, 2013 Could it be that the new Apache configuration isn't setting the REMOTE_USER? Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461009 Share on other sites More sharing options...
Ch0cu3r Posted December 2, 2013 Share Posted December 2, 2013 phpinfo() and the foreach both reveal that HTTP_USER is being set.However, the explicit call for REMOTE_USER comes up blank! Then shouldn't you be using $_SERVER["HTTP_USER"] instead of $_SERVER["REMOTE_USER"]? Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461019 Share on other sites More sharing options...
jgauthier Posted December 3, 2013 Author Share Posted December 3, 2013 That's a typo in my message. I am using REMOTE-USER. Which appears to be correct when I look at all the headers, but empty when I call it explicitly. I am pretty sure this is an apache config issue, but I am stumped with it. Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461141 Share on other sites More sharing options...
requinix Posted December 3, 2013 Share Posted December 3, 2013 REMOTE-USER is not correct. It should be REMOTE_USER or maybe HTTP_USER. Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461147 Share on other sites More sharing options...
jgauthier Posted December 4, 2013 Author Share Posted December 4, 2013 I have set REMOTE_USER, the same thing occurs. Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461251 Share on other sites More sharing options...
jazzman1 Posted December 4, 2013 Share Posted December 4, 2013 Are you able to apply some debugging steps? Any errors? This would be a good start for us. Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461268 Share on other sites More sharing options...
dalecosp Posted December 4, 2013 Share Posted December 4, 2013 (edited) I'm tending to think the key to this is in the original post ... reverse proxy ... unfortunately, all I've ever done with proxies is cache and deny access to pr0n sites.edit: And Woah! Gotta love English ... "cache site pages and deny access to..." Edited December 4, 2013 by dalecosp Quote Link to comment https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/#findComment-1461270 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.