[ASK] How to get domain name from api caller/user?


I’m new to slim framework. I want know way to get domain name from api caller/user?

for example :
Api URL : abc.com/api
Methods : POST

Allowed url to access this api :

  1. one.com
  2. two.com
  3. three.com
  4. Four.com
  5. Five.com
  6. Six.com
  7. Hundred.com

I want to block all domain access to my api except allowed url.

I had read about
Header add Access-Control-Allow-Origin “* or domain.com” , but it seems only for one domain or all domain CMIIW.


You could this from within Slim, perhaps using middleware as described here. But If there are just a few domains/addresses you wish to allow, I’d be more likely do do it through your web server’s access control policies. (Apache Access Control docs.)