Nodejs express request headers - get referrer, etc.

I get a https gateway payment message to confirm the payment, etc. I need to verify that the message was entered from a domain.

I am trying to verify that the referrer belongs to a specific list of domains, but in my req.headers I do not see the referrer | referer:

{ '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' }

Why are my headers empty from fields like referer, origin, etc.

This is in the message:

app.post('/payment/notify/', function(req, res){
   req.headers
})
+5
source share
1 answer

Not all queries have a referencing header.

If the last page on which the browser was turned on is a secure server (https), then it does not send you a referrer.

In addition, if your user enters your address in his address bar, you also do not receive a referrer.

+10
source

All Articles