如何限制我的restapi只能使用node.js的引用URL?

我在nodejs中有一个restAPI,并会限制只从特定的URL访问?

我的node.js代码:

var express=require("express"); var app=express(); var auth = require('basic-auth'); appStart.use(function(req, res, next) { console.log(req.get('origin')); console.log(requestIp.getClientIp(req)); console.log(req.ip); //check the api key username e password var authentication=auth(req); if(authentication.name!="apiTokenUsername" || authentication.pass!="apiTokenPassword") res.status(400).send("Api key Username or password incorrect!"); //check if the ip of request is authorized if(req.ip=="xxx.xxx.xxx.xxx") return next(); //check if the origin of request is authorized if(req.get('origin') == "www.acceptedUrl.com") return next(); //if ip isn't "xxx.xxx.xxx.xxx" or origin isn't "www.acceptedUrl.com" res.status(400).send("You are not authorized!"); }); app.get("*",function(req,res){ res.send("Hello world!); }); 

审议
1)我可以得到请求的IP(req.ip或requestIp.getClientIp(req)),这很好,工作正常!
2)我可以读取请求的来源(req.get('origin')),这很好,工作正常! 但我发现一个问题。

问题
我发现与POSTMAN( https://www.getpostman.com/ )或curl在我的Mac控制台我可以强制在HTML请求标题“源”。 例:

 curl -X GET https://myGateway -H 'origin: www.acceptedUrl.com' 

所以在我的node.js代码中我发现:

 console.log(req.get('origin')); //--> I found www.acceptedUrl.com 

问题
有一种替代的和安全的方式来获取请求的来源?