我们已经将Micronaut服务(带有gradle)部署到AWS Beanstalk中,并通过Angular Application进行使用。在chrome浏览器中一切正常,但是当我们使用IE运行应用程序时,看到以下错误:
我确定我们已在appliaction.yml中启用了CORS
有人可以帮我吗
micronaut:
application:
name: testing-api
server:
port: 4543
cors:
enabled: true
服务应该在所有浏览器中得到响应
我的服务请求标头信息如下所示。
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
答案 0 :(得分:0)
通过此link,我已解决了该问题,方法是将我的micronaut版本升级到1.2.6,并在application.yml文件中设置了单个标头设置。希望这对遇到同样问题的人有所帮助。