美文网首页
SpringCloudZull.md

SpringCloudZull.md

作者: 星异回 | 来源:发表于2019-04-24 11:20 被阅读0次

    一、zuul的特点:

    • 路由+过滤器 =zuul
    • 核心是一系列过滤器

    二、zuul的四中过滤器API

    前置(pre)

    1.应用场景

    • 限流
    • 鉴权
    • 参数检验调整

    后置(post)

    1.应用场景

    • 统计
    • 日志

    路由(Route)

    错误(Error)

    三、请求生命周期

    image.png

    四、配置zuull

    添加依赖

    配置主类

    @EnableZuulProxy

    yml文件中配置为

    zuul:
        Routes:
        #第一种写法
        #规则名称,意思为访问product可以通过/mysss
            myproduct:
                path:/mysss/product/list
                serviceId:product
                #敏感头过滤,设置为空克获取cokkie之类
                sensitiveHeaders:
        #简洁写法
            product:/mysss/product/**
        #禁止不需要暴露的路由,排除某些路由
        ignored-patterns:
            - /mysss/product/list
            - /product/product/list
           # - /**/product/list
       
    #查看配置规则
    management:
        sercurity:
            enabled:false
    #localhost:9000/application/Routes          
    

    相关文章

      网友评论

          本文标题:SpringCloudZull.md

          本文链接:https://www.haomeiwen.com/subject/ulmwgqtx.html