1

My Angular 7 project having an issue while performing HTTP POST request (FormData as request body and having file attachment field (multi-part file)) only in Edge Browser, In other browsers like Chrome, Mozilla, Safari & IE 11 it is working as expected.

My host is localhost with HTTP protocol and i am hitting a remote server which is having a url with HTTPS protocol

My Request Object:

this.httpClient.request(new HttpRequest('POST', url, formData, { responseType: 'text', reportProgress: true}))

Expected Output:
string (success or exception)

Error Facing:
http failure response for (url) 0 unknown error
HTTP status code 0

1 Answers1

0

It can be possible that it is a CORS related issue. MS Edge browser applies different security rules when your site is hosted on localhost.

Try to use fiddler and than try to visit the site using MS Edge. site should open without any issue.

If possible, you can host your site on different web server may help to avoid this issue.

You can try to lower down the security settings for intranet zone and try to test the issue in Edge again to check the result.

For testing purpose, try to keep the same security settings and levels for all the zones.

References:

(1) Angular 5: Http failure response for (unknown url): 0 Unknown Error in EDGE browser when calling api

(2) Why are CORS requests failing in Microsoft Edge but working in other browsers?

(3) I get “Http failure response for (unknown url): 0 Unknown Error” instead of actual error message in Angular

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19