Configuration File For Api Gateway

Devrim Ozcay
1 min readAug 17, 2024

The application.yml file is used to define your application’s configurations in Spring Boot and Spring Cloud projects. This file contains various settings for customizing the behavior of API Gateway. Below, I explain in detail each section of the application.yml file I provided and what these sections mean.

1. Server Block

server:
port: 8080

Specifies which port the API Gateway will operate on. 8080 port is selected here.

2. spring.application Block

spring:
application:
name: api-gateway

The name of the application is “api-gateway”. This is the name to be used in the Spring Cloud environment.

3. spring.cloud.gateway Block

  cloud:
gateway:
routes:
- id: user-service
uri: http://localhost:8081
predicates:
- Path=/users/**
filters:
- StripPrefix=1
- id: content-service
uri: http://localhost:8082
predicates:
- Path=/content/**
filters:
- StripPrefix=1
- id: streaming-service
uri: http://localhost:8083
predicates:
- Path=/stream/**
filters:
- StripPrefix=1

routes Block:
id: A unique ID for the target microservice (user-service, content-service, streaming-service).

--

--