We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在将 API 程序由 Windows 迁移到 CentOS 并由 Nginx 进行反向代理之后,先后解决了 Nginx OPTIONS 请求 405 错误 和 Nginx 不允许跨域请求 这两个问题,但是浏览器中访问的页面调用 API 时,又报下面的错误:
Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response
仔细看了一下报错信息,大意是说 HTTP 请求头中的 Authorization 字段未被允许。
Authorization
上网搜索了一下报错信息 + nginx,按照链接 Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response. (nginx) 中的方法,在 if ($request_method = OPTIONS ) 配置段的 add_header Access-Control-Allow-Headers 这一行中,增加了 Authorization 字段,然后重启了 Nginx,总算解决问题了。
nginx
if ($request_method = OPTIONS )
add_header Access-Control-Allow-Headers
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在将 API 程序由 Windows 迁移到 CentOS 并由 Nginx 进行反向代理之后,先后解决了 Nginx OPTIONS 请求 405 错误 和 Nginx 不允许跨域请求 这两个问题,但是浏览器中访问的页面调用 API 时,又报下面的错误:
Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response
仔细看了一下报错信息,大意是说 HTTP 请求头中的
Authorization
字段未被允许。上网搜索了一下报错信息 +
nginx
,按照链接 Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response. (nginx) 中的方法,在if ($request_method = OPTIONS )
配置段的add_header Access-Control-Allow-Headers
这一行中,增加了Authorization
字段,然后重启了 Nginx,总算解决问题了。The text was updated successfully, but these errors were encountered: