Jump to content

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


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!

Edited by jgauthier
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..."

Edited by dalecosp
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.