Node - Tell origin of request

后端 未结 2 1287
南方客
南方客 2021-02-04 05:02

Is it possible to tell the difference between a request coming directly from a URL in a browser vs. a resource being called from a remote web page?

For example, I would

2条回答
  •  忘掉有多难
    2021-02-04 05:14

    In middleware you have to use this way "req.headers.origin"

    app.use(function(req, res, next) {
        //var origin=req.headers.origin
        next();
    });
    

提交回复
热议问题