我得到一個支付網關https的帖子來驗證付款等。我需要驗證該帖子是否來自域名。Nodejs表示請求標題 - 獲取引用者等。
我試着去驗證引用來自域的特定名單,但在我req.headers我沒有看到一個引用|引用者選擇:
{ 'x-real-ip': '123.34.45.176',
'x-forwarded-for': '123.34.45.176',
host: 'my.foo.com',
'x-nginx-proxy': 'true',
connection: 'close',
'user-agent': 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)',
accept: '*/*',
'content-length': '441',
'content-type': 'application/x-www-form-urlencoded' }
爲什麼我的頭空這些字段如引用者,起源等?
這是一個後內:
app.post('/payment/notify/', function(req, res){
req.headers
})
也許我可以檢查IP地址是否是域名之一? – Harry 2013-04-05 07:24:57
是這就是我要做的,從IP地址獲取主機名。我不認爲他們給我的原因是因爲HTTPS。我使用DNS模塊獲取主機名。像在這個答案prestaul http://stackoverflow.com/questions/4255264/getting-client-hostname-in-node-js – Harry 2013-04-05 07:31:51