1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Header “Access-Control-Allow-Origin”
This guide helps you set up the "Access-Control-Allow-Origin" header, an HTTP header that specifies which origin (domain, protocol, and port) can access resources on a server. This header is used to control cross-origin access (CORS) from a web application.
List of Allowed Domains
You can add the origin of a request to the list of domains allowed to access server resources by adding it to the values of the Access-Control-Allow-Origin
header.
For example, to allow the website https://domain.xyz to access resources with CORS, the header should be as follows:
You can set this via the PHP header() function following the guidance in this FAQ, for example.
If you need this header to be applied everywhere, you can use auto-prepend.