zuul:
routes:
manage‐course: #路由名称,名称任意,保持所有路由名称唯一
path: /course/**
serviceId: xc‐service‐manage‐course #指定服务id,从Eureka中找到服务的ip和端口
#url: http://localhost:31200 #也可指定url
strip‐prefix: false #true:代理转发时去掉前缀,false:代理转发时不去掉前缀
sensitiveHeaders: #默认zuul会屏蔽cookie,cookie不会传到下游服务,这里设置为空则取消默认的黑名
单,如果设置了具体的头信息则不会传到下游服务
# ignoredHeaders: Authorization
@Override
public void configure(HttpSecurity http) throws Exception {
//所有请求必须认证通过
http.authorizeRequests()
//下边的路径放行
.antMatchers("/v2/api‐docs", "/swagger‐resources/configuration/ui",
"/swagger‐resources","/swagger‐resources/configuration/security",
"/swagger‐ui.html","/course/coursepic/list/*")
.permitAll()
.anyRequest().authenticated();
}
zuul:
routes:
xc‐service‐learning: #路由名称,名称任意,保持所有路由名称唯一
path: /learning/**
serviceId: xc‐service‐learning #指定服务id,从Eureka中找到服务的ip和端口
strip‐prefix: false
sensitiveHeaders:
manage‐course:
path: /course/**
serviceId: xc‐service‐manage‐course
strip‐prefix: false
sensitiveHeaders:
manage‐cms:
path: /cms/**
serviceId: xc‐service‐manage‐cms
strip‐prefix: false
sensitiveHeaders:
manage‐sys:
path: /sys/**
serviceId: xc‐service‐manage‐cms
strip‐prefix: false
sensitiveHeaders:
service‐ucenter:
path: /ucenter/**
serviceId: xc‐service‐ucenter
sensitiveHeaders:
strip‐prefix: false
xc‐service‐manage‐order:
path: /order/**
serviceId: xc‐service‐manage‐order
sensitiveHeaders:
strip‐prefix: false
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |