IE browser - Micronaut service throwing "Request header cache-control was not present in the Access-Control-Allow-Headers list" error

0

We have Micronaut services (with gradle) deployed into AWS beanstalk and consuming them through Angular Application. Everything works fine in chrome browser but when we run application with IE seeing below errors:

  • Request header cache-control was not present in the Access-Control-Allow-Headers list.
  • XMLHttpRequest: Network Error 0x80070005, Access is denied.

I am sure that we have enabled CORS in appliaction.yml

Can anyone help me on this please

micronaut:
  application:
    name: testing-api
  server:
    port: 4543
    cors:
      enabled: true

Services should get the response in all the browsers

My service request headers information showing as below.


   Request URL: http://testurl.com/controller/method/stringParam
   Request Method: OPTIONS
   Status Code: 200 / OK

 - Request Headers
   Accept: */*
   Accept-Encoding: gzip, deflate
   Access-Control-Request-Headers: content-type, cache-control, expires, pragma, access-control-allow-headers, accept
   Access-Control-Request-Method: GET
   Cache-Control: no-cache
   Connection: Keep-Alive
   Content-Length: 0
   Host: testurl.com
   Origin: http://localhost:4200
   User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

 - Response Headers
   Access-Control-Allow-Credentials: true
   Access-Control-Allow-Headers: content-type, cache-control, expires, pragma, access-control-allow-headers, accept
   Access-Control-Allow-Methods: GET
   Access-Control-Allow-Origin: http://localhost:4200
   Access-Control-Max-Age: 1800
   Connection: keep-alive
   Date: Tue, 05 Nov 2019 05:23:24 GMT
   Server: nginx/1.14.1
   Transfer-Encoding: chunked
   Vary: Origin
cors
micronaut
asked on Stack Overflow Nov 4, 2019 by Buddha • edited Nov 5, 2019 by Buddha

1 Answer

0

From this link, I have resolved the issue by upgrading my micronaut version to 1.2.6 and setting the single header setting in application.yml file. Hope this helps someone who is having same problem.

answered on Stack Overflow Nov 26, 2019 by Buddha

User contributions licensed under CC BY-SA 3.0