我想使用NodeJS获取域名。
我的代码:request.headers.host
它返回127.0.0.1:3007
而不是http://domainname.fr
...
编辑#1:
{"host":"127.0.0.1:3007","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36","referer":"http://domainname.fr/option/seo/edit","accept-encoding":"gzip, deflate, sdch","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","cookie":"wp-settings-1=libraryContent%3Dbrowse%26post_dfw%3Doff%26hidetb%3D1%26editor%3Dtinymce; wp-settings-time-1=1453197454; _ga=GA1.2.1880128487.1451319866; connect.sid=s%3A6rtTBduaUul9Q0o_p7vxF6TzmMcfQs19.kaBdkoGAeQtQuxHsfwDsEscbOYFsZpnTIlluk2u0X0Q","x-forwarded-for":"86.207.238.8","x-forwarded-host":"domainname.fr","x-forwarded-server":"domainname.fr","connection":"Keep-Alive"}