HTTP request works with cURL but gets CORS response when created in browser using javascript

When I access the type API through a browser using $ .get or a superspy or query or axiom, I get a "No Access" error message, available on the requested resource. Origin ' http: // localhost: 8100 ', therefore not allowed.

However, when the user is CURL or HTTPIE or Postman to make the same request, it always works every time. How to solve this behavior and how to implement the client version?

+4
source share
2 answers

CORS . , CORS .

+4

CORS htaccess.

.htaccess : ( , )

<FilesMatch ".(eot|ttf|otf|woff)">
    Header set Access-Control-Allow-Origin "*"
</FilesMatch>
0

All Articles