当前位置:网站首页>Zuul路由的映射规则配置
Zuul路由的映射规则配置
2022-07-17 05:21:00 【是一个菜鸟程序员啊】
一般的写法是这样子的
其作用是将符合/eureka-consumer/**规则的请求路径转发到名为eureka-consumer的服务实例上,其中routers(是指eureka-consumer,)可以指定为任意的路由名称(例如eureka-consumer2),但serviceId必须是Eureka服务注册中心的服务实例
这种写法的话,就可以通过eureka-consumer1来访问,或者eureka-consumer


但值得注意的是,在默认情况下,Zuul会自动为Eureka服务注册中心的所有服务实例创建映射关系,也就是说,也可以通过eureka-provider来访问,只不过是端口号的不同而已
例如这样
如果不想使用默认的路由规则,就可以在配置文件中加入下列内容,即可关闭所有默认的配置规则
zuul:
routes:
ignored-services: '*'
关闭所有默认的路由映射配置规则,这样只能根据path里面的路径进行访问
eureka-provider方法就不行了,只能通过eureka-consumer1这个路径

其实,网关路由的配置还有一种更简便的方法,就是zuul.routes.serviceId(指定路由的具体服务名)=path(配置匹配的请求映射地址)
zuul:
routes:
eureka-consumer:
path: /eureka-consumer1/**
边栏推荐
猜你喜欢

C 语言结构体数组指针以及函数

Machine learning - classification prediction of logistic regression

F5LTM(一)逻辑关系图

How can the new generation of CS sdnand (also known as patch T card) make the old MCU youthful

notepad++下划线以及大小写字母置换

Common user password encryption methods and cracking methods

Top command

Drawing PCB with Altium Designer

Information on successful cooperation between CS brand sdnand and stm32mcu

Application case of CS brand sdnand in color detector industry
随机推荐
MySQL MySQL calculates the number of weekends this year (Saturday and Sunday)
F5 GTM(一):DNS参数
Share the application cases of CS brand patch T card in the field of hunting camera
华为路由 端口映射
Generate audio and waveform in PWM and DAC exercises of stm32
Wireshark packet capture: message information
TCP/IP四层模型以及F5部分相关配置
毛毛上班(递推)
释放nohup.out占用的磁盘空间
Share the successful cooperation between CS brand sdnand and wearable devices
勒索病毒防护浅谈
Hand in hand building a home NAS universal server (1) | configuration selection and preparation
Slag learning path (1) output the calendar page of a certain month of a certain year
小迪网络安全笔记-信息收集-架构、搭建、waf(8)
F5 GTM (I): DNS parameters
OLED data display based on spi/iic interface
Part of the second Shanxi Network Security Skills Competition (Enterprise Group) WP (III)
top命令
Binary search and its extension
Pytorch deep learning practice-b station Liu erden-day3