'How to solve CORS problem on requests on angular?
Description
I'm trying to make a POST request like this :
return this.http.post("http://192.168.28.88:6010/api"+ '/login', user);
I got this error on my browser :
Access to XMLHttpRequest at 'http://192.168.88.28:6010/api/login' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Note: I tried to solution about proxyConfig but not working.
Need your helps
Solution 1:[1]
Try adding a HTTP Header
httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
}
return this.http.post("http://192.168.28.88:6010/api"+ '/login', user, this.httpOptions);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jose Vicente |
