Some smartass people are using my api-centric web app to clone my service and make it appear like their own. Is there a way to make sure all ajax requests are for/from my website?
Sure I could use the referrer header but they could easily fake it.
Some smartass people are using my api-centric web app to clone my service and make it appear like their own. Is there a way to make sure all ajax requests are for/from my website?
Sure I could use the referrer header but they could easily fake it.
Set a cookie on the client when it hits your site, before it sends any Ajax requests.
Then validate the cookie when serving the Ajax.
Or alternatively you could make your Ajax requests POST only. This way they are subject to the same origin policy.
It will break the whole restful ideology though.