Hi, I want my API to be accessible just from my SPA and nothing else can send a request to the API. How can I do that? Should I use CORS allowed_origins?
I setted 'supports_credentials' => false and the 'allowed_origins' => ['...'] to desired domain. Now the server prevents the browser requests from other origins but unfortunately responses to other clients like postman or curl. I want to prevent that.
That is not possible.
A request from javascript is a normal http request how every client can do it. So you can't block ips neither blocking any special header because a client like postman can send all this.
protect your backend with authentication and authorisation, so only a user can do what he is allowed to. than it theoretically doesnt matter if he does it via you frontend or something else