0

I've a Angular6 project and with Chrome, Firefox, Safari and Edge this problem not exist.

But using Internet Explorer in console I've this situation

enter image description here

detailed error is:

enter image description here

Pratically fail the OPTIONS request (before the GET). But, If I remove from the search (in the Angular Service) the search Params "id, pageSize and sort" the request work. Even If I leave just one parameter (example id) works. But with all the parameters, don't.

Searching online give no help to me. Seems that I.E. has a problem with the lenght of the URL on the OPTIONS request, but I don't know how fix this issue.

My JAVA backend, in the Spring configuration, has the allowed to all methods GET, PUT, DELETE, OPTIONS, POST (on others browser this problem don't exist).

I think it's due to CORS policy but why only with IE this problem?

Ho can I customize the request GET (if identifing I.E as browser) to bypass this problem or resolve definitively?

Some people says that I can add some directives in the header of all GET request with an interceptor, but how? And especially, what I've to add to header to fix this problem?

Domenico
  • 292
  • 2
  • 10
  • 26
  • Can you please provide the request headers sent from Chrome/FF/Edge? And maybe show the service code? – Luca Regazzi Aug 27 '19 at 16:54
  • 1
    The 400 error indicates that the server was unable to process the request sent by the client due to invalid syntax. First, you should compare the request url and request headers between IE and other browsers to see if there's any difference. Second, OPTIONS request is a ["preflight" request](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Functional_overview). Please make sure you have the correct CORS headers. For more information. you could refer to [this thread](https://stackoverflow.com/questions/40497399/http-request-from-angular-will-send-with-method-options-instead-of-post). – Yu Zhou Aug 28 '19 at 06:16
  • the request final code showed on console is not significant, because show "0" as error code. But the POST request, have a 400 error. – Domenico Aug 30 '19 at 09:05
  • Please make sure you have set the right `Origin` header. You could refer to [this thread](https://stackoverflow.com/questions/45792360/http-preflight-options-request-fails-in-ie-only) to see if you have the similar issue. Besides, you could refer to [this article](http://restlet.com/company/blog/2016/09/27/how-to-fix-cors-problems/) about fixing CORS problems. – Yu Zhou Sep 02 '19 at 04:03

0 Answers0