Jump to content

$_SERVER["REMOTE_USER"] blank.. but not really?


jgauthier

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/284454-_serverremote_user-blank-but-not-really/
Share on other sites

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..."

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.