What is a Gateway Service?

Gateway Services represent the upstream services in your system. Services are the business logic components of your system that are responsible for processing and responding to requests. Gateway Services, in conjunction with Routes, let you expose your upstream services to clients with Kong Gateway.

The configuration of a Gateway Service defines the connectivity details between the Kong Gateway and the upstream service, along with other metadata. Generally, you should map one Gateway Service to each upstream service.

Here’s how it works:

  1. A client sends a request.
  2. A Route matches the request based on defined rules and sends it to a specific Gateway Service.
  3. The Gateway Service receives the request and forwards it to your actual application (the upstream service).
    • For simple deployments, the upstream URL can be provided directly in the Gateway Service.
    • For sophisticated traffic management needs, a Gateway Service can point at an Upstream entity.
  4. The upstream service processes the request and sends a response back through Kong Gateway.

Plugins can also be attached to a Service, and will run against every request that triggers a request to the Service that they’re attached to.

 
flowchart LR
  A(API client)
  B("`Route 
  (/mock)`")
  C("`Gateway Service
  (example-service)`")
  D(Service 
  application)
  
  A <--requests
  responses--> B
  subgraph id1 ["`
  **KONG GATEWAY**`"]
    B <--requests
    responses--> C
  end
  C <--requests
  responses--> D

  style id1 rx:10,ry:10
  
  

Figure 1: Diagram showing the request and response flow through Kong Gateway.

Schema

Set up a Gateway Service

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!