Kasper Souren Kasper Souren - 1 year ago 226
Node.js Question

Meteor: How to get the hostname, server side

On the client I can use

to get the hostname. How can I get the same on the server?
I need this to work behind an Apache proxy, unfortunately
gives me
. I also want it to work for different domains, I want one Meteor app that gives different results for different domains.

This question is somewhat related: Node JS get server hostname of current process

Answer Source

Meteor.absoluteUrl() given that your ROOT_URL env variable is set correctly.

See the following docs: http://docs.meteor.com/#meteor_absoluteurl.

Meteor doesn't know the outside-facing address of the proxy that it's sitting behind, and the (virtual) domain that this proxy was accessed by would have to be forwarded to the Meteor app for it to do what you are asking for. I don't think this is currently supported.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download