我为休息端点启用了CORS,我需要在“访问控制 - 允许 - 标题”中添加一个标题。报头中。
public void configure() {
restConfiguration().component("netty4-http").bindingMode(RestBindingMode.json)
.contextPath("/").port(8099)
.enableCORS(true)
.corsAllowCredentials(true)
.corsHeaderProperty("Access-Control-Allow-Headers", "Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization");
不幸的是,响应并未反映这些设置(缺少授权标头):
Access-Control-Allow-Headers → Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers
Access-Control-Allow-Methods → GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
Access-Control-Allow-Origin → *
Access-Control-Max-Age → 3600
我无法找出为什么标题不能由' .corsHeaderProperty()'设置。 非常感谢任何帮助,谢谢。