I am using kong API-gateway for API management.
Suppose I have a service named alpha. I am serving kong on port 80 and alpha on port 8000 both in the same docker network named kong-net
and each on a different docker container, one named kong
and the other named alpha
I am using kong in a declarative DB-less mode. So my configuration should be as below in kong.yml
:
_format_version: "2.1"
_transform: true
services:
- name: alpha-live
host: alpha
port: 8000
protocol: http
path: /live
routes:
- name: alpha-live
methods:
- GET
paths:
- /alpha/live
strip_path: true
What I am looking for is that when a request is received by http://kong/alpha/live
decide to either
- terminate the request OR
- pass it
http://alpha:8000/live
based on some conditions (probably coming from SLA metrics) set on the content of the request. it might be a key, value in the header, body, etc
I there a way to do it?
There is this plugin request-termination
https://docs.konghq.com/hub/kong-inc/request-termination/ but cannot use conditions.
Any idea?
You can use the request-termination plugin because it able to be handled by trigger which can be part of the header, have a look at https://docs.konghq.com/hub/kong-inc/request-termination/#new-in-210. An example could look like this;