赞
踩
网关作为流量的入口,常用功能包括路由转发、权限校验、限流控制。
- spring:
- cloud:
- gateway:
- routes:
- - id: test_route
- uri: http://www.baidu.com
- predicates:
- #访问的路径就是 如果是/hello?url=baidu 就转发到 https://www.baidu.com/hello?url=baidu
- - Query=url,https://www.baidu.com
- - id: test1_route
- uri: http://www.hao123.com
- predicates:
- - Query=url,hao123
bootstrap.yml
- spring:
- application:
- name: gulimall-gateway
- cloud:
- nacos:
- config:
- server-addr: 192.168.2.36:8848
- namespace: 255b4d7d-a41d-4340-b4e0-8fcb111fc978
- group: dev
- file-extension: yaml
nacos config
- spring:
- application:
- name: gulimall-gateway
- cloud:
- nacos:
- discovery:
- server-addr: 192.168.2.36:8848
- server:
- port: 88
导入的依赖
- <dependency>
- <groupId>org.springframework.cloud</groupId>
- <artifactId>spring-cloud-starter-gateway</artifactId>
- </dependency>
详细的后面在介绍
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。