Update: 增加 api-gateway
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
server:
|
||||
port: 8080
|
||||
spring::
|
||||
application:
|
||||
name: api-gateway
|
||||
cloud:
|
||||
gateway:
|
||||
routes:
|
||||
# 路由到service-producer服务
|
||||
- id: service-producer
|
||||
uri: lb://service-producer
|
||||
predicates:
|
||||
- Path=/api/producer/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
# 路由到service-consumer服务
|
||||
- id: service-consumer
|
||||
uri: lb://service-consumer
|
||||
predicates:
|
||||
- Path=/api/consumer/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
# 全局过滤器配置
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowedOrigins: "*"
|
||||
allowedMethods: "*"
|
||||
allowedHeaders: "*"
|
||||
# 全局默认路由
|
||||
default-filters:
|
||||
- AddResponseHeader=Access-Control-Allow-Origin,*
|
||||
- AddResponseHeader=Access-Control-Allow-Methods,GET,POST,PUT,DELETE,OPTIONS
|
||||
- AddResponseHeader=Access-Control-Allow-Headers,Content-Type,Authorization
|
||||
# 服务发现配置
|
||||
discovery:
|
||||
client:
|
||||
simple:
|
||||
instances:
|
||||
eureka-server:
|
||||
- uri: http://localhost:8761
|
||||
# 服务注册配置
|
||||
cloud:
|
||||
config:
|
||||
uri: http://localhost:8888
|
||||
# Eureka客户端配置
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://localhost:8761/eureka/
|
||||
instance:
|
||||
prefer-ip-address: true
|
||||
Reference in New Issue
Block a user