How to check if cross-domain requests are disabled

2019-07-11 17:07发布

I keep reading that to make ajax requests safe, I need to make sure that cross-site requests are disabled. On the server side, how exactly do I disable cross-site requests, or check if they are disabled/enabled?

3条回答
Ridiculous、
2楼-- · 2019-07-11 17:27

Cross site requests are disabled by default..
fyi : take a look at same origin policy : http://en.wikipedia.org/wiki/Same_origin_policy

查看更多
何必那么认真
3楼-- · 2019-07-11 17:32

Cross domain is always banned because of the Same Origin Policy.

As for your JavaScript making a XHR and someone spoofing one, they are the same and impossible to differentiate (though you can definitely make it harder).

查看更多
Emotional °昔
4楼-- · 2019-07-11 17:36

May be someone can open your page in hyperlink so please make sure that http referrer is always from your site.

查看更多
登录 后发表回答