允许来自特定移动应用的API调用

通过使用Node和Express,我可以只允许来自特定移动应用程序的HTTP REST调用吗?

出于安全原因,我想实现这些:

1. Allow only specific IP range. Since both of the app is hosted using Azure website. 2. Allow only connection from specific mobile app. 

使用CORS或JSONP

在CORS

例如,要允许http://mozilla.com访问资源,可以指定:

Access-Control-Allow-Origin: http : //mozilla.com

您可以检查HTTP头来获取客户端ips,看到这里检查您的IP列表的IP,只有如果成功返回。

Interesting Posts