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

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -