zuul转发Set-Cookie丢失问题

默认过滤的header

spring-cloud-netflix-core-1.2.6.RELEASE-sources.jar!/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java


/**
     * List of sensitive headers that are not passed to downstream requests. Defaults to a
     * "safe" set of headers that commonly contain user credentials. It's OK to remove
     * those from the list if the downstream service is part of the same system as the
     * proxy, so they are sharing authentication data. If using a physical URL outside
     * your own domain, then generally it would be a bad idea to leak user credentials.
     */
    private Set<String> sensitiveHeaders = new LinkedHashSet<>(
            Arrays.asList("Cookie", "Set-Cookie", "Authorization"));

配置

zuul:
  sensitiveHeaders:  
  host:
    socket-timeout-millis: 60000
    connect-timeout-millis: 60000  

通过显示指定为空,表示让zuul的过滤header列表为空,这样就可以正常返回了

spring读取cookie方法

String xxx = WebUtils.getCookie((HttpServletRequest) servletRequest,"your-cookie-name").getValue();

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,099评论 19 139
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,992评论 6 342
  • 本文参考了:http://blog.didispace.com/springcloud7/http://blog....
    WeiminSun阅读 7,282评论 0 23
  • 向来总有一些悲寂凄苦藏于心中,各行各业,人生百态,看过一些风情风景,总觉不够,还想上靠去了解更多。人活一世,见的越...
    安成霜阅读 186评论 0 0
  • 有这么一个故事:有一年秋天,一群天鹅来到天鹅湖的一个小岛上。它们从遥远的北方飞来,准备去南方过冬。岛上住着老渔夫和...
    如料阅读 280评论 1 0