huaweicloud / spring-cloud-huawei

Spring Cloud Huawei is a framework that makes it easier and productive to develop microservices with Spring Cloud.
https://github.com/huaweicloud/spring-cloud-huawei/wiki
Apache License 2.0
516 stars 221 forks source link

when router enabled may cause http header twice the size of the original and cause header too big #933

Closed liubao68 closed 1 year ago

liubao68 commented 1 year ago

Describe the bug when router enabled may cause http header twice the size of the original and cause header too big.

To Reproduce NA

Expected behavior Improve the header size as much as possible.

Information

Spring Cloud Huawei version: 1.10.x Spring Cloud version(optional): Spring Boot version(optional): Spring version(optional):

Additional context NA

liubao68 commented 1 year ago

变更说明:这个修改是一个优化,会存在灰度发布行为的变更。

如果服务调用经过 用户 -> A -> B -> C (A可以是网关,也可以不是), B 要进行灰度发布规则配置, 那么用户传递给A的所有header信息, 会设置到上下文中, 这个时候, B能够从上下文获取到header信息,进行匹配。

如果服务调用经过 用户 -> A -> B -> C (A可以是网关,也可以不是), B 要进行灰度发布规则配置, 那么用户传递给A的所有header信息, 不会设置到上下文中。

如果需要,用户需要显示的制定具体的需要复制到上下文的header信息,比如:

spring:
  cloud:
    servicecomb:
      context:
        headerContextMapper:
          canary: canary

上传配置将用户传递的 canary 头设置到请求上下文中,灰度发布可以读取请求上下文的头进行匹配。