【发布时间】:2023-03-11 21:12:01
【问题描述】:
我们将 Micronaut 服务(带有 gradle)部署到 AWS beanstalk 中,并通过 Angular 应用程序使用它们。在 chrome 浏览器中一切正常,但是当我们使用 IE 运行应用程序时,会看到以下错误:
- Access-Control-Allow-Headers 列表中不存在请求标头缓存控制。
- XMLHttpRequest:网络错误 0x80070005,访问被拒绝。
我确信我们已经在 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
【问题讨论】:
-
Access-Control-Allow-Headers预检请求标头中包含什么? -
@Jeff Scott Brown,我添加了我在浏览器中看到的请求和响应标头信息。
-
@Jeff Scott Brown,你有机会看看我的回复吗?