stnoonan / spnego-http-auth-nginx-module

SPNEGO HTTP Authentication Module for nginx
Other
276 stars 112 forks source link

How to set user name when forwarding to backend service #110

Closed rshah2019 closed 3 years ago

rshah2019 commented 3 years ago

so my ngnix configuration has following. How can I forward authenticated user name to my backend service ? My backend service would like to fetch this user name and use it to do something given each request.

    location /api/endpoint/ {
        proxy_pass http://www.example-service.com:5000
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
serdula commented 3 years ago

Hi, did you try?

proxy_pass_header Authorization; 

or

proxy_set_header X-User $remote_user;