微服务访问链路流程:
1、一个前端的界面入口普通链接(调用微服务)
http://yuanqudev1.xx.com/evhas(系统普通链接)
2、请求来到Nginx(配置访问转发到的地址,这里是gateway、系统的唯一入口)
location /evh/ {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_pass http://localhost:8780;
}
3、gateway routes路由配置,
- id: officeauto-api
order: 0
uri: lb://officeauto
predicates:
- Path=/evh/meeting/**
filters:
- RewritePath=/evh/(?<segment>.*), /officeauto/$\{segment}
经过网关路由变为:http://yuanqudev1.xx.com/officeauto/meeting/listMyMeetings
INFO [com.everhomes.gateway.GlobalFilters] - Session [2593880688374212]
Request uri=http://yuanqudev1.xx.com/officeauto/meeting/listMyMe