最近真是被这个分布式的权限设计,搞的郁闷,项目紧,任务重,天天加班
先说背景,项目要实现微服务的权限验证,这里:
sc-gateway 网关
网关要配置
E:\IdeaWkSpace\SmartCommunity\sc-gateway\src\main\resources\application.properties
spring.application.name=sc-gateway
server.port=8020
#zuul.host.socket-timeout-millis=60000
#zuul.host.connect-timeout-millis=60000
#zuul.routes.api-a.path=/producer/**
#zuul.routes.api-a.url=spring-cloud-producer
#下面这里就是原因了,这里配置了权限验证的微服务是sc-auth ,地址用/auth/**
#也就是,当访问/auth开头的api,就被网关自动转到sc-auth这个微服务上去了
zuul.routes.sc-auth.path=/auth/**
#zuul.routes.auth.sensitive-headers=""
zuul.routes.sc-auth.service-id=sc-auth
#zuul.add-proxy-headers=true
#security.basic.e

本文记录了在使用SpringCloud构建微服务过程中遇到的Zuul网关异常问题。当尝试访问授权服务sc-auth时,由于该服务未启动导致ZuulException: Forwarding error。解决方案涉及理解Ribbon的负载均衡机制,并确保所有微服务正常运行。
订阅专栏 解锁全文
2万+





