Gateway Service Configuration (gateway-service)¶
The gateway-service handles client ingress routing, JWT token validation, Redis session checks, CORS, and request header enrichment.
Runtime and Service Metadata¶
These settings control the gateway process, how it identifies itself in service discovery, and how it shuts down during deployments.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
server.port |
8000 base, 8081 dev |
SERVER_PORT |
HTTP ingress port. Dev overrides the base value. |
server.shutdown |
graceful |
SERVER_SHUTDOWN |
Shutdown mode. Allowed: graceful waits for in-flight requests to finish; immediate stops without waiting. |
spring.profiles.active |
${ACTIVE_PROFILE:dev} |
ACTIVE_PROFILE, SPRING_PROFILES_ACTIVE |
Active Spring profile. Common values: dev for local development, k8s when a Kubernetes profile exists, or any custom profile with a matching application-<profile>.yml. |
spring.application.name |
gen-itech-gateway-service |
SPRING_APPLICATION_NAME |
Service name used by Spring and discovery. |
info.app.name |
Gen-itech Gateway Service |
— | Human-readable service name shown by the actuator info endpoint. |
info.app.profile |
${spring.profiles.active} |
— | Active profile surfaced in actuator info. |
info.app.description |
This service is responsible for authorizing gateway requests. |
— | Human-readable service purpose shown by the actuator info endpoint. |
info.app.version |
1.0 |
— | Application version shown by the actuator info endpoint. |
Actuator and Health¶
Actuator is Spring Boot's operational endpoint layer. It exposes health, metrics, environment, and diagnostic endpoints used by operators, load balancers, and Kubernetes probes.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
management.endpoints.web.exposure.include |
* |
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE |
Actuator endpoints exposed over HTTP. Allowed examples: * exposes all; health,info exposes only health and info. Restrict this in production if actuator is reachable outside the private network. |
management.info.env.enabled |
true |
MANAGEMENT_INFO_ENV_ENABLED |
Environment-backed actuator info. Allowed: true includes configured info values; false hides environment-backed info. |
management.endpoint.health.probes.enabled |
true |
MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED |
Enables Kubernetes-style health probes. Allowed: true creates liveness/readiness health groups; false exposes only standard health behavior. |
Eureka Discovery¶
Eureka is the service registry. The gateway fetches the registry so lb://client-service and lb://sms-router-service route targets can be resolved dynamically.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
eureka.client.fetch-registry |
true |
EUREKA_CLIENT_FETCH_REGISTRY |
Registry lookup. Allowed: true downloads service instances from Eureka; false disables registry lookup and breaks lb:// routing. |
eureka.client.service-url.defaultZone |
http://localhost:8761/eureka/ |
EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE |
Eureka registry endpoint. |
eureka.instance.preferIpAddress |
true |
EUREKA_INSTANCE_PREFER_IP_ADDRESS |
Base registration address type. Allowed: true registers the instance IP address; false registers hostname. |
eureka.instance.prefer-ip-address |
true dev |
EUREKA_INSTANCE_PREFER_IP_ADDRESS |
Dev registration address type. Allowed: true registers the instance IP address; false registers hostname. |
eureka.instance.leaseRenewalIntervalInSeconds |
10 |
EUREKA_INSTANCE_LEASE_RENEWAL_INTERVAL_IN_SECONDS |
Eureka lease renewal interval. |
eureka.instance.leaseExpirationDurationInSeconds |
30 |
EUREKA_INSTANCE_LEASE_EXPIRATION_DURATION_IN_SECONDS |
Eureka lease expiration duration. |
eureka.instance.instance-id |
${spring.application.name}:${random.value} |
EUREKA_INSTANCE_INSTANCE_ID |
Registered Eureka instance ID. |
Gateway Discovery and HTTP Client¶
Spring Cloud Gateway evaluates route predicates, forwards matching requests to downstream services, and uses the HTTP client settings for those outbound calls.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
spring.codec.max-in-memory-size |
64MB |
SPRING_CODEC_MAX_IN_MEMORY_SIZE |
Maximum request body buffered while forwarding payloads such as CSV uploads. |
spring.cloud.gateway.discovery.locator.lower-case-service-id |
true |
SPRING_CLOUD_GATEWAY_DISCOVERY_LOCATOR_LOWER_CASE_SERVICE_ID |
Discovery route service ID casing. Allowed: true normalizes service IDs to lowercase; false keeps registry casing. |
spring.cloud.gateway.discovery.locator.enabled |
true |
SPRING_CLOUD_GATEWAY_DISCOVERY_LOCATOR_ENABLED |
Discovery locator integration. Allowed: true allows routes from discovered services; false uses only explicitly configured routes. |
spring.cloud.gateway.httpclient.connect-timeout |
120000 |
SPRING_CLOUD_GATEWAY_HTTPCLIENT_CONNECT_TIMEOUT |
Downstream connection timeout in milliseconds. |
spring.cloud.gateway.httpclient.response-timeout |
120s |
SPRING_CLOUD_GATEWAY_HTTPCLIENT_RESPONSE_TIMEOUT |
Downstream response timeout. |
Authentication Properties¶
The gateway validates bearer tokens before forwarding protected requests. The secret must match the token issuer in client-service.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
jwt.secret.key |
Required | JWT_SECRET_KEY |
Shared JWT signing/validation secret. Must match the key used by client-service. |
Redis Session Properties¶
The gateway validates authenticated requests by looking up sms:token:{token} in Redis.
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
redis.host |
localhost |
REDIS_HOST |
Redis host. |
redis.port |
6379 |
REDIS_PORT |
Redis port. |
redis.password |
Empty | REDIS_PASSWORD |
Redis password. |
redis.database.index |
5 |
REDIS_DATABASE_INDEX |
Redis logical database. |
redis.pool.max.connection |
100 |
— | Maximum Redis pool size. |
redis.pool.max.idle.connection |
10 |
— | Maximum idle Redis connections. |
redis.pool.min.idle.connection |
0 |
— | Minimum idle Redis connections. |
Logging¶
| Property | Value / Default | Env Variable | Description |
|---|---|---|---|
logging.config |
classpath:log/logback-dev.xml |
LOGGING_CONFIG |
Logback configuration used in dev. |
CORS Configuration¶
Cross-Origin Resource Sharing controls which browser-based frontends can call the gateway. This matters only for browser clients; server-to-server calls are not governed by CORS.
| Property | Value / Default | Description |
|---|---|---|
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedOrigins[0] |
http://localhost:3000 |
First allowed browser origin. |
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedOrigins[1] |
http://localhost:8080 |
Second allowed browser origin. |
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedMethods |
GET,POST,PUT,DELETE,OPTIONS |
Allowed HTTP methods. |
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedHeaders |
Authorization,Content-Type,X-Admin-API-Key |
Allowed request headers. |
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowCredentials |
true |
Credentialed browser requests. Allowed: true permits cookies/authorization credentials with matching origins; false disallows credentialed CORS requests. |
spring.cloud.gateway.globalcors.cors-configurations.[/**].maxAge |
3600 |
Browser preflight cache age in seconds. |
Ingress Routes¶
Routes map incoming path patterns to backend services. lb:// means the target service is resolved through the service registry rather than a fixed host.
Each row maps the route array entry's id, uri, and first predicate (predicates[0]).
| Route Entry | id |
uri |
predicates[0] |
|---|---|---|---|
spring.cloud.gateway.routes[0] |
client-service-auth |
lb://client-service |
Path=/auth/** |
spring.cloud.gateway.routes[1] |
sms-router-admin |
lb://sms-router-service |
Path=/admin/sms-config/** |
spring.cloud.gateway.routes[2] |
client-service-admin |
lb://client-service |
Path=/admin/clients/** |
spring.cloud.gateway.routes[3] |
client-service-reports |
lb://client-service |
Path=/admin/reports/** |
spring.cloud.gateway.routes[4] |
client-service-internal |
lb://client-service |
Path=/internal/clients/** |
spring.cloud.gateway.routes[5] |
sms-router-service-api |
lb://sms-router-service |
Path=/api/sms/** |
spring.cloud.gateway.routes[6] |
sms-router-campaigns |
lb://sms-router-service |
Path=/api/campaigns/** |
spring.cloud.gateway.routes[7] |
client-service |
lb://client-service |
Path=/api/** |