Tobi
Tobi

Reputation: 1313

Multiple Domains for the same Meteor App - how to get the URL

I need to serve a meteor-app on several domains (e.g. customer1.com and customer2.com) and based upon which domain it runs on, it should serve different css files and change its behaviour a little.

I use nginx as a proxy to forward all incoming traffic (except for some special subdomains) to this webapp.

(how) is it possible to get the URL, over which the app is accessed inside of meteor?

Upvotes: 0

Views: 179

Answers (1)

Ryan W
Ryan W

Reputation: 6173

If you're using iron-router you can get the host from the request object

Router.route('/testHost', function() {
  this.response.end(this.request.headers.host);
  //the page will print out something like 127.0.0.1:3000 
}, {where: 'server'});

Upvotes: 1

Related Questions