Get subdomain in publish (solved)


#1

Hi,

currently i use https://github.com/gadicc/meteor-headers/ to get the referer. I need the subdomain the user calls.

Is there a way to get this info without the package? Somehting like this.request.headers[‘referer’] i can use in a server route.

Update
made a mistake with nginx configuration. Turns out, its very simple.

The following needs to be in the nginx config:

proxy_set_header Host      $host;
proxy_set_header X-Forwarded-For $remote_addr;

Now i can get the subdomain with:

  var full = this.connection.httpHeaders.host
  var parts = full.split('.');
  var subdomain = parts[0];

Benjamin