server: port: 9080 spring: application: name: kilimo-gateway # 2. Redis Configuration data: redis: host: localhost port: 6379 connect-timeout: 2000ms # 3. Gateway Routing (Modern WebFlux Namespace) cloud: gateway: server: webflux: globalcors: cors-configurations: '[/**]': # URL pattern to apply the configuration to allowedOrigins: # Allows requests from a specific origin - "*" allowedMethods: - "*" allowedHeaders: - "*" # Allows all headers allowCredentials: false # Allows the browser to send cookies/auth headers maxAge: 3600 # Cache the preflight response for 1 hour routes: - id: kilimo_core_service uri: http://farm-kilimo-ms-core:9081 predicates: - Path=/core/** - Method=GET,POST,PUT,DELETE,OPTIONS,PATCH filters: - RewritePath=/core/(?.*), /$\{path} - name: AuthFilter - name: RequestRateLimiter args: redis-rate-limiter.replenishRate: 10 redis-rate-limiter.burstCapacity: 20 key-resolver: "#{@userKeyResolver}" - id: kilimo_assistant_service uri: http://farm-kilimo-ms-assistant:9082 predicates: - Path=/assistant/** - Method=GET,POST,PUT,DELETE,OPTIONS,PATCH filters: - RewritePath=/assistant/(?.*), /${segment} - name: AuthFilter - name: RequestRateLimiter args: redis-rate-limiter.replenishRate: 10 redis-rate-limiter.burstCapacity: 20 key-resolver: "#{@userKeyResolver}" config: enabled: false # 4. Actuator for Troubleshooting management: endpoints: web: exposure: include: gateway, health, info endpoint: gateway: enabled: true # 5. Debugging Logging (Helpful to fix the 404) logging: level: org.springframework.cloud.gateway: TRACE org.springframework.http.server.reactive: DEBUG