Answer the question
In order to leave comments, you need to log in
How to enable CORS in public API?
Hello.
The question is:
I make a request using axios, there I pass only 2 headers, Authorization and Content-Type.
I wrote the following on the server:
$response
->setHeader("Access-Control-Allow-Origin", "*")
->setHeader("Access-Control-Allow-Methods", "GET, POST, PUT")
->setHeader("Access-Control-Allow-Headers", "*")
->setHeader("Access-Control-Allow-Credentials", true)
->sendHeaders();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question