Routes
Route entities define rules to match client requests. Each route is associated with a service, and a service may have multiple routes associated to it. Every request matching a given route will be proxied to the associated service. You need at least one matching rule that applies to the protocol being matched by the route.
The combination of routes and services, and the separation of concerns between them, offers a powerful routing mechanism with which it is possible to define fine-grained entrypoints in Kong Gateway leading to different upstream services of your infrastructure.
Depending on the protocol, one of the following attributes must be set:
http: At least one ofmethods,hosts,headers, orpathshttps: At least one ofmethods,hosts,headers,paths, orsnistcp: At least one ofsourcesordestinationstls: at least one ofsources,destinations, orsnistls_passthrough: setsnisgrpc: At least one ofhosts,headers, orpathsgrpcs: At least one ofhosts,headers,paths, orsnisws: At least one ofhosts,headers, orpathswss: At least one ofhosts,headers,paths, orsnis
A route can’t have bothtlsandtls_passthroughprotocols at same time.
Learn more about the router:- Configure routes using expressions
List all Routes
List all Routes
Query Parameters
Number of resources to be returned.
Default:100
>= 1<= 1000
Offset from which to return the next set of resources. Use the value of the ‘offset’ field from the response of a list operation as input here to paginate through all the resources
A list of tags to filter the list of resources on. Multiple tags can be concatenated using ‘,’ to mean AND or using ‘/’ to mean OR.
Example:tag1,tag2
Filter routes by a substring of the name.
Example:john
Filter routes by their name.
Example:john
Path Parameters
The UUID of your control plane. This variable is available in the Konnect manager.
Example:9524ec7d-36d9-465d-a8c5-83a3c9390458
Response
application/json
Response
A successful response listing Routes
One OfRoute entities define rules to match client requests. Each Route is associated with a Service, and a Service may have multiple Routes associated to it. Every request matching a given Route will be proxied to its associated Service. The combination of Routes and Services (and the separation of concerns between them) offers a powerful routing mechanism with which it is possible to define fine-grained entry-points in Kong leading to different upstream services of your infrastructure. You need at least one matching rule that applies to the protocol being matched by the Route.
Example:{"hosts":["foo.example.com","foo.example.us"],"id":"56c4566c-14cc-4132-9011-4139fcbbe50a","name":"example-route","paths":["/v1","/v2"],"service":{"id":"bd380f99-659d-415e-b0e7-72ea05df3218"}}
Show Child Parameters
URI to the next page (may be null)
Offset is used to paginate through the API. Provide this value to the next list operation to fetch the next page
Authentication
Path Parameters
Query Parameters
Create a new Route
Create a new Route
Path Parameters
The UUID of your control plane. This variable is available in the Konnect manager.
Example:9524ec7d-36d9-465d-a8c5-83a3c9390458
Body
application/json
Body
Description of the new Route for creation
Route
One OfUnix epoch when the resource was created.
A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
One or more lists of values indexed by header name that will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. When headers contains only one value and that value starts with the special prefix ~*, the value is interpreted as a regular expression.
A list of domain names that match this Route. Note that the hosts value is case sensitive.
The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the https protocol.
Allowed values:301302307308426
Default:426
A string representing a UUID (universally unique identifier).
A string representing an HTTP method, such as GET, POST, PUT, or DELETE. The string must contain only uppercase letters.
The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named “test” and “Test”.
Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior.
Allowed values:v0v1
Default:v0
A string representing a router path. It must start with a forward slash (‘/’) for a fixed path, or the sequence ‘~/’ for a regex path. It must not have empty segments.
When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
Default:false
A string representing a protocol, such as HTTP or HTTPS.
Allowed values:grpcgrpcshttphttpstcptlstls_passthroughudpwswss
Default:https
>= 1 characters
A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
Default:0
Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.
Default:true
Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.
Default:true
The Service this Route is associated to. This is where the Route proxies traffic to.
Show Child Parameters
A string representing a wildcard host name, such as *.example.com.
A list of IP sources of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.
Default:true
A string representing a tag.
Unix epoch when the resource was last updated.
Response
application/json
Response
Successfully created Route
Route
One OfUnix epoch when the resource was created.
A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
One or more lists of values indexed by header name that will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. When headers contains only one value and that value starts with the special prefix ~*, the value is interpreted as a regular expression.
A list of domain names that match this Route. Note that the hosts value is case sensitive.
The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the https protocol.
Allowed values:301302307308426
Default:426
A string representing a UUID (universally unique identifier).
A string representing an HTTP method, such as GET, POST, PUT, or DELETE. The string must contain only uppercase letters.
The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named “test” and “Test”.
Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior.
Allowed values:v0v1
Default:v0
A string representing a router path. It must start with a forward slash (‘/’) for a fixed path, or the sequence ‘~/’ for a regex path. It must not have empty segments.
When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
Default:false
A string representing a protocol, such as HTTP or HTTPS.
Allowed values:grpcgrpcshttphttpstcptlstls_passthroughudpwswss
Default:https
>= 1 characters
A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
Default:0
Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.
Default:true
Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.
Default:true
The Service this Route is associated to. This is where the Route proxies traffic to.
Show Child Parameters
A string representing a wildcard host name, such as *.example.com.
A list of IP sources of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.
Default:true
A string representing a tag.
Unix epoch when the resource was last updated.
Authentication
Path Parameters
Body
Delete a Route
Delete a Route
Path Parameters
ID of the Route to lookup
Example:a4326a41-aa12-44e3-93e4-6b6e58bfb9d7
The UUID of your control plane. This variable is available in the Konnect manager.
Example:9524ec7d-36d9-465d-a8c5-83a3c9390458
Response
Response
Successfully deleted Route or the resource didn’t exist
Authentication
Path Parameters
Get a Route
Get a Route using ID or name.
Path Parameters
ID of the Route to lookup
Example:a4326a41-aa12-44e3-93e4-6b6e58bfb9d7
The UUID of your control plane. This variable is available in the Konnect manager.
Example:9524ec7d-36d9-465d-a8c5-83a3c9390458
Response
application/json
Response
Successfully fetched Route
Route
One OfUnix epoch when the resource was created.
A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
One or more lists of values indexed by header name that will cause this Route to match if present in the request. The Host header cannot be used with this attribute: hosts should be specified using the hosts attribute. When headers contains only one value and that value starts with the special prefix ~*, the value is interpreted as a regular expression.
A list of domain names that match this Route. Note that the hosts value is case sensitive.
The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the https protocol.
Allowed values:301302307308426
Default:426
A string representing a UUID (universally unique identifier).
A string representing an HTTP method, such as GET, POST, PUT, or DELETE. The string must contain only uppercase letters.
The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named “test” and “Test”.
Controls how the Service path, Route path and requested path are combined when sending a request to the upstream. See above for a detailed description of each behavior.
Allowed values:v0v1
Default:v0
A string representing a router path. It must start with a forward slash (‘/’) for a fixed path, or the sequence ‘~/’ for a regex path. It must not have empty segments.
When matching a Route via one of the hosts domain names, use the request Host header in the upstream request headers. If set to false, the upstream Host header will be that of the Service’s host.
Default:false
A string representing a protocol, such as HTTP or HTTPS.
Allowed values:grpcgrpcshttphttpstcptlstls_passthroughudpwswss
Default:https
>= 1 characters
A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same regex_priority, the older one (lowest created_at) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
Default:0
Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.
Default:true
Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.
Default:true
The Service this Route is associated to. This is where the Route proxies traffic to.
Show Child Parameters
A string representing a wildcard host name, such as *.example.com.
A list of IP sources of incoming connections that match this Route when using stream routing. Each entry is an object with fields “ip” (optionally in CIDR range notation) and/or “port”.
Show Child Parameters
When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.
Default:true
A string representing a tag.
Unix epoch when the resource was last updated.