Updated gateway cors

This commit is contained in:
2026-03-17 20:22:12 +03:00
parent b3351c88ff
commit 5664e30b91
2 changed files with 84 additions and 90 deletions
+42 -45
View File
@@ -15,52 +15,49 @@ spring:
# 3. Gateway Routing (Modern WebFlux Namespace)
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allowedOrigins:
- "http://localhost:3000"
- "https://kilimo.farm"
- "https://vm-qpse3mho5qps7fj2kw0hzy.vusercontent.net"
allowedMethods:
- GET
- POST
- PUT
- DELETE
- OPTIONS
allowedHeaders:
- "*"
allowCredentials: true
maxAge: 3600 # cache preflight response for 1 hour
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://localhost:9081
predicates:
- Path=/core/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/core/(?<path>.*), /$\{path}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
routes:
- id: kilimo_core_service
uri: http://localhost:9081
predicates:
- Path=/core/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/core/(?<path>.*), /$\{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://localhost:9082
predicates:
- Path=/assistant/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/assistant/(?<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/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/assistant/(?<segment>.*), /${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:
+42 -45
View File
@@ -15,52 +15,49 @@ spring:
# 3. Gateway Routing (Modern WebFlux Namespace)
cloud:
gateway:
globalcors:
cors-configurations:
'[/**]':
allowedOrigins:
- "http://localhost:3000"
- "https://kilimo.farm"
- "https://vm-qpse3mho5qps7fj2kw0hzy.vusercontent.net"
allowedMethods:
- GET
- POST
- PUT
- DELETE
- OPTIONS
allowedHeaders:
- "*"
allowCredentials: true
maxAge: 3600 # cache preflight response for 1 hour
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://localhost:9081
predicates:
- Path=/core/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/core/(?<path>.*), /$\{path}
- name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
routes:
- id: kilimo_core_service
uri: http://localhost:9081
predicates:
- Path=/core/**
- Method=GET,POST,PUT,DELETE,OPTIONS
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/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/assistant/(?<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/**
- Method=GET,POST,PUT,DELETE,OPTIONS
filters:
- RewritePath=/assistant/(?<segment>.*), /${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: