Updated gateway cors

This commit is contained in:
2026-03-17 17:22:22 +03:00
parent 338ab9aaf2
commit abef2b364a
+28 -33
View File
@@ -15,44 +15,11 @@ spring:
# 3. Gateway Routing (Modern WebFlux Namespace) # 3. Gateway Routing (Modern WebFlux Namespace)
cloud: cloud:
gateway: gateway:
server:
webflux:
routes:
# --- Core Service Route ---
- id: kilimo_core_service
uri: http://localhost:9081
predicates:
- Path=/core/**
filters:
- RewritePath=/core/(?<segment>.*), /$\{segment}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
# --- Assistant Service Route ---
- id: kilimo_assistant_service
uri: http://localhost:9082
predicates:
- Path=/assistant/**
filters:
- RewritePath=/assistant/(?<segment>.*), /$\{segment}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
globalcors: globalcors:
cors-configurations: cors-configurations:
'[/**]': '[/**]':
allowedOrigins: allowedOrigins:
- "http://localhost:3000" - "http://localhost:3000"
- "http://127.0.0.1:3000"
- "https://vm-qpse3mho5qps7fj2kw0hzy.vusercontent.net"
- "https://www.kilimo.farm"
- "https://kilimo.farm" - "https://kilimo.farm"
allowedMethods: allowedMethods:
- GET - GET
@@ -63,6 +30,34 @@ spring:
allowedHeaders: allowedHeaders:
- "*" - "*"
allowCredentials: true allowCredentials: true
maxAge: 3600 # cache preflight response for 1 hour
routes:
- id: kilimo_core_service
uri: http://localhost:9081
predicates:
- Path=/core/**
filters:
- RewritePath=/core/(?<segment>.*), /$\{segment}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
- id: kilimo_assistant_service
uri: http://localhost:9082
predicates:
- Path=/assistant/**
filters:
- RewritePath=/assistant/(?<segment>.*), /$\{segment}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
# 4. Actuator for Troubleshooting # 4. Actuator for Troubleshooting
management: management: