作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
只是想澄清一下 - 在 Netflix 的 Zuul 网关中,RequestContext 对象有两个方法,setSendZuulResponse 和 removeRouteHost。
首先,谁能告诉我两者之间的区别。从这里 post ,他们做同样的事情,但我找不到描述这些( sendZuulResponse 和 removeRouteHost )的文档。
其次,Zuul 过滤器是否会命中资源/源服务器而不管是否被过滤但只是隐藏了对客户端的响应?基于 sendZuulResponse 的文档, 它说:
"If this value if true then the response should be sent to the client."
最佳答案
如果您使用的是 Spring Cloud Netflix Zuul 依赖项,则 SimpleHostRoutingFilter进行下游调用的类,只有在满足以下代码时才会被激活
RequestContext.getCurrentContext().getRouteHost() != null && RequestContext.getCurrentContext().sendZuulResponse();
从中我们可以看到,如果路由主机为 null 或 Zuul 响应设置为 false,则过滤器将不会运行,也不会向下游服务发出请求。
关于spring-boot - Zuul 网关 - setSendZuulResponse & removeRouteHost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46639448/
只是想澄清一下 - 在 Netflix 的 Zuul 网关中,RequestContext 对象有两个方法,setSendZuulResponse 和 removeRouteHost。 首先,谁能告诉
我是一名优秀的程序员,十分优秀!