且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

飞行前响应中的Access-Control-Allow-Headers不允许请求标头字段…

更新时间:2022-01-18 21:20:36

您的问题出在后端。似乎您要使用的api是用Django编写的。

Your problem is in the backend. Seems like the api you are trying to use is written in django.

api所有者需要将该标头明确添加到CORS_ALLOW_HEADERS设置中。上传图片时,Content-Disposition标头存在相同的问题。这是我的设置:

The api owner needs to explicitly add that header into the CORS_ALLOW_HEADERS settings. I had the same issue with the Content-Disposition header while uploading images. This is my settings:

CORS_ALLOW_HEADERS = ('content-disposition', 'accept-encoding',
                      'content-type', 'accept', 'origin', 'authorization')

在您的情况下,设置需要包含缓存控制。

In your case, that setting needs to include 'cache-control'.