How to get “HTTP_REFERER” with NodeJS?

后端 未结 1 919
天涯浪人
天涯浪人 2021-01-30 12:53

A way to get HTTP_REFERER , We can use document.referrer in browser side javascript . But how can we get it in NodeJS ?

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 13:05

    You can get it by...

    req.headers.referer
    

    in...

    var http = require('http');
    server = http.createServer(function(req, res){
    ...
    }
    

    0 讨论(0)
提交回复
热议问题