Restrict Cross Domain Ajax Request
I have web application (In java) where I need to restrict Cross Domain request through Ajax call in any browser (Including IE restricting XDomainRequest object) through jquery or s
Solution 1:
You can control which domains you accept AJAX requests from via the Access-Control-Allow-Origin response header. If the header is missing, only requests from the same domain are allowed.
Update: if you want to disallow even the initiation of AJAX requests, you could try X-Content-Security-Policy:
xhr-src 'none'
, but I can't imagine any situation where that would be useful. Maybe you could explain the situation in a little more detail?
Post a Comment for "Restrict Cross Domain Ajax Request"