简体   繁体   English

获取没有express.js的域名

[英]Get domain name without express.js

I have a MEAN app which responds to multiple domains. 我有一个MEAN应用,可以响应多个域。 Domains are pointed to same IP and port. 域指向相同的IP和端口。

Is there a way to get domain name from client request, without express.js? 没有express.js,有没有办法从客户端请求中获取域名?

So that I can load different database based on request domain name. 这样我就可以根据请求域名加载不同的数据库。 I tried using process.domain and os.hostname which does not work on Windows OS (not sure about other OS). 我尝试使用process.domainos.hostname在Windows操作系统上不起作用(不确定其他操作系统)。

尝试从标题中挑选出来:

request.headers.host

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM