From abef2b364a395e931d658f7608fad04ec0ebfece Mon Sep 17 00:00:00 2001 From: augustus Date: Tue, 17 Mar 2026 17:22:22 +0300 Subject: [PATCH] Updated gateway cors --- kilimo-gateway-production.yml | 61 ++++++++++++++++------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/kilimo-gateway-production.yml b/kilimo-gateway-production.yml index 1b8c7aa..1c9fd89 100644 --- a/kilimo-gateway-production.yml +++ b/kilimo-gateway-production.yml @@ -15,44 +15,11 @@ spring: # 3. Gateway Routing (Modern WebFlux Namespace) cloud: gateway: - server: - webflux: - routes: - # --- Core Service Route --- - - id: kilimo_core_service - uri: http://localhost:9081 - predicates: - - Path=/core/** - filters: - - RewritePath=/core/(?.*), /$\{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} - - name: AuthFilter - - name: RequestRateLimiter - args: - redis-rate-limiter.replenishRate: 10 - redis-rate-limiter.burstCapacity: 20 - key-resolver: "#{@userKeyResolver}" globalcors: cors-configurations: '[/**]': allowedOrigins: - "http://localhost:3000" - - "http://127.0.0.1:3000" - - "https://vm-qpse3mho5qps7fj2kw0hzy.vusercontent.net" - - "https://www.kilimo.farm" - "https://kilimo.farm" allowedMethods: - GET @@ -63,6 +30,34 @@ spring: allowedHeaders: - "*" 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} + - 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} + - name: AuthFilter + - name: RequestRateLimiter + args: + redis-rate-limiter.replenishRate: 10 + redis-rate-limiter.burstCapacity: 20 + key-resolver: "#{@userKeyResolver}" # 4. Actuator for Troubleshooting management: