Han*_*ank 6 javascript security web-services
我有http://example.com/index.html,从HTML中使用JavaScript(XmlHttpRequest)来调用Web服务http://example.com/json/?a=...&b=...
Web服务返回到index.htmlJSON信息数组,然后显示在其上index.html.
由于任何人都可以查看源代码index.html并查看我如何调用JSON Web服务(http://example.com/json/),如何阻止人们直接调用我的JSON Web服务?
由于Web服务本质上是一个开放的读取到我的数据库,我不希望人们滥用网络服务,并开始直接从Web服务获取数据,启动DoS攻击我的服务器,获取比他们应该更多的信息,等等.
更新:
有没有办法限制http://example.com/json/只来自同一服务器(IP)和URL请求的请求http://example.com/index.html?
意思是,无法http://example.com/json/检测到Requester是($_SERVER['REQUEST_URI'] == http://example.com/index.html)并且只允许那个?