security - PHP Programmaticaly allow/deny domains -
security - PHP Programmaticaly allow/deny domains -
so have got rest api has private , public api's. in code allow , deny requests per api. utilize piece of code:
public function allowdomain($domain) { header('access-control-allow-origin: ' . $domain); }
now after research not sure if safe way of doing (since of spoofing). right thing or there more? if what?
to secure api (the private part) should utilize keys or tokens. access-control-allow-origin
on client side, javscript doesn't request apis isn't set security reasons. can still access api in browser or somewhere else.
see: https://developer.mozilla.org/en-us/docs/web/http/access_control_cors
php security rest
Comments
Post a Comment