How to set CORS?

I use Nginx+PHP-FPM requests to install such header—č
add_header 'Access-Control-Allow-Origin' 'http://localhost:8080';
 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT';
 add_header 'Access-Control-Allow-Headers' '*';
 add_header 'Access-Control-Expose-Headers' '*';


When you send a request with my vue application using axios get the error
Access to XMLHttpRequest at 'localhost/api/institutes/6fe90daaeeaa3f272d8196bb7...' from origin 'localhost:8080' has been blocked by CORS policy: The value of The 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request''s credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.


But in response comes the expected response to me

How to fix this error?
March 23rd 20 at 18:41
2 answers
March 23rd 20 at 18:43
Solution
add_header 'Access-Control-Allow-Origin' 'http://localhost:8080';

localhost/api/institutes/6fe90daaeeaa3f272d8196bb7...' from origin 'localhost:8080' has been blocked


Perhaps the problem is in the port.
March 23rd 20 at 18:45
You do not mind that the url request is nothing about 8080 port no? Well, anyway, why is it in principle?

Find more questions by tags CORSNginx