Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$remote_user not available on the the directive #142

Open
minijusl opened this issue Jun 6, 2023 · 0 comments
Open

$remote_user not available on the the directive #142

minijusl opened this issue Jun 6, 2023 · 0 comments

Comments

@minijusl
Copy link

minijusl commented Jun 6, 2023

There are couple issues/questions asking how to retrieve remote user in backend application and the correct answer is pass it down as a custom header via proxy to the backend application.

#14
https://stackoverflow.com/questions/70191631/how-to-get-username-after-successful-kerberos-authentication-using-nginx

I was trying to return $remote_user immediately in the same location directive's block. Unfortunately, it always returns empty value even the authentication itself is successful.

        location / {
          auth_gss on;
          auth_gss_keytab /usr/local/etc/krb5.keytab;
          auth_gss_allow_basic_fallback off;

          add_header Content-Type text/plain;
          return 200 'remote user: $remote_user';
        }

Same, behaviour is observed on access.log as well - $remote_user is always empty.

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant