1.修改host文件
在windows系统下,地址映射文件配置就在hosts文件,文件的位置在C盘下的system32/driver/etc/hosts,添加以下配置
--本机地址 映射域名
127.0.0.1 cloud.wangle.com
2.配置application.yml
spring:
application:
name: gateway-admin
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allowedOrigins: "*"
allowedMethods:
- GET
- POST
- PUT
- DELETE
routes:
- id: file
#微服务的ip+port
uri: http://localhost:8002
#
predicates:
- Host=cloud.wangle.com**
本文详细介绍如何在Windows系统中通过修改host文件实现本地域名映射,并配置Spring Cloud Gateway的全局跨域设置及路由规则,确保微服务间的有效通信。
7203

被折叠的 条评论
为什么被折叠?



