500 (Internal Server Error)

Hi,
I am calling the post api with ‘HttpHeaders’ in ionic 3, but getting ‘500 (Internal Server Error)’. Url & request body is correct. I’ve tried this on both the platform mobile & web. Receiving this error: “Response for preflight has invalid HTTP status code 500.” in console.
Please help me, if I am doing something wrong.

//Request
var filterProperty={
offset:0,
recordlimit:10,
orderby: “formname”
};

var filters:Array<{ fieldname: string, fieldvalue: any, operators: string }>;

filters=[{
  fieldname: "formid",
  fieldvalue:["1"],
  operators: "In"
}];

var filterRequest ={
    app:true,
    auth: false,
    filter: filters,
    filterproperty:filterProperty
};

//Api call
var httpHeaders=new HttpHeaders();
httpHeaders.set(‘Accept’,‘application/json’);
httpHeaders.set(‘Source-Api’, ‘wemaplus’);

var url=‘http://wema-env-design.eu-west-2.elasticbeanstalk.com/data/api/formbuilder’;

var response= this.httpClient.post(url,filterRequest,
  {
    headers:httpHeaders
  });
return response;

Any time I see the word “preflight”, I assume the problem is CORS-related.

It of course is, the server is returning an error 500 to requests of the OPTIONS type. Nothing you can do about that in the JS/TS code - you have to fix your server.

Yeah , I see. It’s a CORS issue.
I’ve added proxy in ‘ionic.config.json’ file, but it’s not working.

{
“name”: “myApp”,
“app_id”: “”,
“type”: “ionic-angular”,
“integrations”: {
“cordova”: {}
},
“proxies”: [
{
“path”: “/api”,
“proxyUrl”: “http://wema-env-design.eu-west-2.elasticbeanstalk.com/data
}
]
}

Now, I am getting this response:

{“status”:false,“error”:“Unsupported content-type”}

Status Code: 203 Non-Authoritative Information

I had CORS issue and added proxy to ionic.config.json
Now I get this error

{"headers":{"normalizedNames":{},"lazyUpdate":null},"status":500,"statusText":"Internal Server Error","url":"http://localhost:8100/api","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://localhost:8100/api: 500 Internal Server Error","error":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Error: getaddrinfo ENOTFOUND myurl.com myurl.com:443<br> &nbsp; &nbsp;at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)</pre>\n</body>\n</html>\n"}

Here is the link to my post
What does this error mean and what can I do to rectify it?