Routes

Create a new Route

Create a new Route

post/v2/control-planes/{controlPlaneId}/core-entities/routes

Request body

created_atinteger nullable

Unix epoch when the resource was created.

headersobject nullable

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.

hostsstring[] nullable

A list of domain names that match this Route. Note that the hosts value is case sensitive.

https_redirect_status_code301 | 302 | 307 | 308 | 426 nullable

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.

idstring nullable

A string representing a UUID (universally unique identifier).

methodsstring[] nullable

A list of HTTP methods that match this Route.

namestring nullable

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".

path_handling'v0' | 'v1' nullable

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.

pathsstring[] nullable

A list of paths that match this Route.

preserve_hostboolean nullable

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.

protocolsstring[] nullable

An array of the protocols this Route should allow. See the Route Object section for a list of accepted protocols. When set to only "https", HTTP requests are answered with an upgrade error. When set to only "http", HTTPS requests are answered with an error.

regex_priorityinteger nullable

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).

request_bufferingboolean nullable

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.

response_bufferingboolean nullable

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.

snisstring[] nullable

A list of SNIs that match this Route when using stream routing.

strip_pathboolean nullable

When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.

tagsstring[] nullable

An optional set of strings associated with the Route for grouping and filtering.

updated_atinteger nullable

Unix epoch when the resource was last updated.

Example request

{
  "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"
  }
}

Response

Successfully created Route

created_atinteger nullable

Unix epoch when the resource was created.

headersobject nullable

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.

hostsstring[] nullable

A list of domain names that match this Route. Note that the hosts value is case sensitive.

https_redirect_status_code301 | 302 | 307 | 308 | 426 nullable

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.

idstring nullable

A string representing a UUID (universally unique identifier).

methodsstring[] nullable

A list of HTTP methods that match this Route.

namestring nullable

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".

path_handling'v0' | 'v1' nullable

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.

pathsstring[] nullable

A list of paths that match this Route.

preserve_hostboolean nullable

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.

protocolsstring[] nullable

An array of the protocols this Route should allow. See the Route Object section for a list of accepted protocols. When set to only "https", HTTP requests are answered with an upgrade error. When set to only "http", HTTPS requests are answered with an error.

regex_priorityinteger nullable

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).

request_bufferingboolean nullable

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.

response_bufferingboolean nullable

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.

snisstring[] nullable

A list of SNIs that match this Route when using stream routing.

strip_pathboolean nullable

When matching a Route via one of the paths, strip the matching prefix from the upstream request URL.

tagsstring[] nullable

An optional set of strings associated with the Route for grouping and filtering.

updated_atinteger nullable

Unix epoch when the resource was last updated.

Example response

{
  "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"
  }
}

Changes

Changed in 8 of the 52 revisions of this API.13568

  • f0305901662214See the full diff
    • the request property's minLength was increased from 0 to 1

      request-property-min-length-increased

    • the // request property's max was set to 65535.00

      request-property-max-set

    • the // request property's max was set to 65535.00

      request-property-max-set

    • the // request property's min was set to 0.00

      request-property-min-set

    • the // request property's min was set to 0.00

      request-property-min-set

  • 96118a9cd7f4418See the full diff
    • the response property // became nullable for the status

      response-property-became-nullable

    • the response property // became nullable for the status

      response-property-became-nullable

    • the response property // became nullable for the status

      response-property-became-nullable

    • the response property // became nullable for the status

      response-property-became-nullable

    • the request property // became nullable

      request-property-became-nullable

    • the request property // became nullable

      request-property-became-nullable

    • the request property // became nullable

      request-property-became-nullable

    • the request property // became nullable

      request-property-became-nullable

    • the request property default value 426 was added

      request-property-default-value-added

    • the request property default value v0 was added

      request-property-default-value-added

    • the request property default value false was added

      request-property-default-value-added

    • the request property default value 0 was added

      request-property-default-value-added

    • the request property default value true was added

      request-property-default-value-added

    • the request property default value true was added

      request-property-default-value-added

    • the request property default value true was added

      request-property-default-value-added

    • the response's property default value 426 was added for the status

      response-property-default-value-added

    • the response's property default value v0 was added for the status

      response-property-default-value-added

    • the response's property default value false was added for the status

      response-property-default-value-added

    • the response's property default value 0 was added for the status

      response-property-default-value-added

    • the response's property default value true was added for the status

      response-property-default-value-added

    • the response's property default value true was added for the status

      response-property-default-value-added

    • the response's property default value true was added for the status

      response-property-default-value-added

    This revision also has 7 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 2c77aeaee5fb11See the full diff
    • the response property became nullable for the status

      response-property-became-nullable

    • the request property became nullable

      request-property-became-nullable

    • the request property default value http https was added

      request-property-default-value-added

    • the response's property default value http https was added for the status

      response-property-default-value-added

  • fc6abbc537f326See the full diff
    • the response property became nullable for the status

      response-property-became-nullable

    • the response property became nullable for the status

      response-property-became-nullable

    • the request optional property became not read-only

      request-optional-property-became-not-read-only

    • the request optional property became not read-only

      request-optional-property-became-not-read-only

    • the request property became nullable

      request-property-became-nullable

    • the request property became nullable

      request-property-became-nullable

    • the response optional property became not read-only for the status

      response-optional-property-became-not-read-only

    • the response optional property became not read-only for the status

      response-optional-property-became-not-read-only

    This revision also has 7 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • the / request property type changed from string to array

      request-property-type-changed

    • the / response's property type changed from string to array for status

      response-property-type-changed

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • the request property became not nullable

      request-property-became-not-nullable

  • 08ead66e9ebb2141See the full diff
    • the request's body type changed from no type to object

      request-body-type-changed

    • the response's body type changed from no type to object for status

      response-body-type-changed

    • removed subschema #2 from the request body allOf list

      request-body-all-of-removed

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • added the new optional request property

      new-optional-request-property

    • removed subschema #2 from the response body allOf list for the response status

      response-body-all-of-removed

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    • added the optional property to the response with the status

      response-optional-property-added

    This revision also has 88 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog