Request header field * is not allowed by Access-Control-Allow-Headers in preflight response问题解决

2023-05-25,,

跨域问题
报错信息为:Failed to load http://192.168.30.119: Request header field language is not allowed by Access-Control-Allow-Headers in preflight response.

原因:前台发送的请求体包含了没有允许的Header

如何解决问题:在请求体加入允许的Header类型

原有代码: response.setHeader(“Access-Control-Allow-Headers”, “x-requested-with,Authorization”);
修改后: response.setHeader(“Access-Control-Allow-Headers”, "x-requested-with,Authorization,language");

Request header field * is not allowed by Access-Control-Allow-Headers in preflight response问题解决的相关教程结束。

《Request header field * is not allowed by Access-Control-Allow-Headers in preflight response问题解决.doc》

下载本文的Word格式文档,以方便收藏与打印。