# 500 (Internal Server Error)

**URL:** <https://forum.ionicframework.com/t/500-internal-server-error/126945>\
**Category:** ionic-v3\
**Created:** [April 5, 2018, 7:53am UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945 "2018-04-05T07:53:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tousifraza](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@tousifraza](https://forum.ionicframework.com/u/tousifraza)\
**Post date:** [April 5, 2018, 7:53am UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/1 "2018-04-05T07:53:04Z")

</div>

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](http://wema-env-design.eu-west-2.elasticbeanstalk.com/data/api/formbuilder)’;

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

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [April 5, 2018, 1:32pm UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/2 "2018-04-05T13:32:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [April 5, 2018, 1:45pm UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/3 "2018-04-05T13:45:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tousifraza](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@tousifraza](https://forum.ionicframework.com/u/tousifraza)\
**Post date:** [April 5, 2018, 1:49pm UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/4 "2018-04-05T13:49:20Z")

</div>

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](http://wema-env-design.eu-west-2.elasticbeanstalk.com/data)”  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![tousifraza](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@tousifraza](https://forum.ionicframework.com/u/tousifraza)\
**Post date:** [April 10, 2018, 7:39am UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/5 "2018-04-10T07:39:39Z")

</div>

Now, I am getting this response:

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

Status Code: 203 Non-Authoritative Information

---

<div class="post-metadata">

**Author:** ![ankant](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@ankant](https://forum.ionicframework.com/u/ankant)\
**Post date:** [July 4, 2019, 10:07am UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/6 "2019-07-04T10:07:00Z")

</div>

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

```auto
{"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](https://forum.ionicframework.com/t/ionic-native-http-post-formdata/167754)  
What does this error mean and what can I do to rectify it?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:42pm UTC](https://forum.ionicframework.com/t/500-internal-server-error/126945/7 "2021-07-19T21:42:05Z")

</div>

Closed on July 19, 2021, 9:42pm UTC


