liubao68 commented on issue #1542: 为什么服务端读出的cookie会丢失内容?
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1542#issuecomment-575426995
 
 
   看你的描述没太理解里面的过程。 Nginx -> 服务端; 工具 -> 服务端 这两个过程看起来场景是一样的,不应该存在不一样的情况。 
   
   不过使用java-chassis需要有个主意的地方,如果经过多跳到达服务端:比如 Nginx -> Edge service -> 微服务, 
或者Nginx -> 微服务A -> 微服务B, 那么后面的微服务可能是获取不到在“契约”以外的数据的,包括你说的cookie。 
因为java-chassis设计的时候, 没有完全假设底层运行的是HTTP协议,而是任何可能的协议。所以关注的数据是“契约”描述的数据。 
   
   早起的一些应用场景,比如通过cookie, HTTP Header等认证的情况, 可以尝试配套 
HttpServerFilter和InvocationContext来实现。 
首先自定义HttpServerFilter,将需要获取的数据设置到InvocationContext里面, 
业务代码需要使用的地方,通过InvocationContext获取。 
这个流程你可以通过[servicecomb-fence](https://github.com/apache/servicecomb-fence)看到一些代码示例
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to