title: Passing nginx headers to client through nodejs
body: <p>I am trying to figure out what the best way would be to pass geoIP info of users to client-side javascript. I have configured nginx for this and am able to send the info to my node + express server. </p>
  
  <p>I don't know what the next step is. From googling around i can see the headers I am trying to send can't directly be read by js on client-side.</p>
  
  <p>This is what I have -- </p>
  
  <p>Nodejs--</p>
  
  <pre><code>router.get('/', function(req, res, next) {
    res.setHeader("geoip_country_code", req.headers.geoip_country_code);
    res.setHeader("geoip_city", req.headers.geoip_city);
    res.render('index', { title: 'bla' });
    console.log(req.headers);
  });
  </code></pre>
  
  <p>Nginx -- </p>
  
  <pre><code>location / {
              proxy_set_header Host $host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
              proxy_set_header GEOIP_CITY $geoip_city;
              proxy_set_header GEOIP_LATITUDE $geoip_latitude;
              proxy_set_header GEOIP_LONGITUDE $geoip_longitude;
              proxy_pass http://app:3000;
          }
  </code></pre>