使用expressjs获取完整的域名网址

时间:2014-12-17 08:11:57

标签: node.js express

我想使用expressjs获取完整的网址,但它不能与我的代码一起使用,我得到IP地址而不是域名......

我的代码:request.protocol + '://' + request.get('host') + request.originalUrl

结果:http://127.0.0.1:3009/

应该是:http://domainaname.fr/blog/1/name-of-my-article

编辑#1

{ host: '127.0.0.1:3009',
[mydomain.fr.3009-27 (out)]   via: '1.1 SRVAFW32K3',
[mydomain.fr.3009-27 (out)]   cookie: '__utma=118302353.915172217.1415970012.1418720938.1418727366.17; __utmc=118302353; __utmz=118302353.1417190225.6.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _ga=****; connect.sid=s%3Ashyx4InRi3AR89XyuSkHxDwXFXW3BbTF.**%2FQMG8fQqqPdc',
[mydomain.fr.3009-27 (out)]   'if-none-match': 'W/"1d58-1752282781"',
[mydomain.fr.3009-27 (out)]   'user-agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
[mydomain.fr.3009-27 (out)]   'cache-control': 'max-age=0',
[mydomain.fr.3009-27 (out)]   accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
[mydomain.fr.3009-27 (out)]   'accept-language': 'en-US,en;q=0.8,ca;q=0.6,de;q=0.4,es;q=0.2,fil;q=0.2,fr;q=0.2,it;q=0.2,pt;q=0.2',
[mydomain.fr.3009-27 (out)]   'x-forwarded-for': '90.*.*.71',
[mydomain.fr.3009-27 (out)]   'x-forwarded-host': 'mydomain',
[mydomain.fr.3009-27 (out)]   'x-forwarded-server': 'mydomain.fr',
[mydomain.fr.3009-27 (out)]   connection: 'Keep-Alive' }

0 个答案:

没有答案