yhs0092 opened a new issue, #4232: URL: https://github.com/apache/servicecomb-java-chassis/issues/4232
## 问题版本 Java-Chassis 2.8.x ## 问题原理 在Java-Chassis 1.3.x版本, 使用CORS功能时, 业务可以通过向`servicecomb.cors.origin`配置项设置一个pattern串来匹配多个origin, 如`http://xxx:8080|http://yyy:8080`. Java-Chassis会将`servicecomb.cors.origin`配置项的值传递给`io.vertx.ext.web.handler.CorsHandler#create`方法, 此方法接收的是一个 pattern 串, 内部会将字符串转为 `java.util.regex.Pattern` 对象, 用于正则匹配 origin. 但在 Java-Chassis 2.8.x 版本, 由于 Vert.x 版本升级, API变化, Java-Chassis 改为调用 `io.vertx.ext.web.handler.CorsHandler#addOrigin` 方法添加 origin 放通规则, 此方法内部是依赖 `io.vertx.ext.web.impl.Origin` 对象做匹配的, 这种机制不是正则表达式, 而且对于多个 origin 的匹配, 需要多次调用 `addOrigin` 方法添加规则. 因此, 对于从旧版本升级到新版本的业务, 此配置项发生了不兼容变化. 并且, 无法配置多条 origin 放通规则. ## 预期行为 能否将`servicecomb.cors.origin`配置项的行为改回跟 Java-Chassis 1.3.x 版本一致. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
