title: How to get http header(LDAP user attribute set by Nginx) with React component
body: <p>searched a lot, and referred to <a href="https://stackoverflow.com/questions/44354763/how-do-i-get-http-headers-in-react-js">this</a>,  but didn't get detailed answer. </p>
  
  <p>I wanted to get LDAP login user name(X-Forwarded-User attribute set by nginx) from http header within React component(client side), 
  tried first approach in link with 'fetch', get empty header;
  second approach to use window.<strong>INITIAL_HEADERS</strong> variable, not quite clear how to use it in React component. 
  What's the right way to do it? and how to get other attributes of LDAP login user, eg. email ( there is a LDAP attribute 'email' configured on LDAP server) . Thanks. </p>
  
  <p>relative nginx conf as below</p>
  
  <pre><code>location /noc/ {
          auth_ldap "Enter AD credentials: ";
          auth_ldap_servers server1;
          keepalive_timeout 300s;
          proxy_pass http://ui/noc/;
          proxy_set_header X-Forwarded-User $remote_user;
  </code></pre>
  
  <p>}</p>
  
  <p>React JS, used React Route in App.js for the component link
      </p>
  
  <pre><code>//in another file Noc.js for the React component
  fetch("/noc/").then(response=&gt;{
    console.log("headers:");
    console.log(response.headers); //empty {}
  });
  </code></pre>