Add a Service and Route
This guide walks through the creation and configuration of a
Service and Route via Kong Manager in Kong Enterprise.
For the purpose of this guide, we’ll create a Service pointing to the Mockbin
API. Mockbin is an “echo” type public website that returns requests back to
the requester as responses. This visibility is helpful for learning how Kong proxies API
Kong exposes the RESTful Admin API on port
:8001. Kong’s configuration,
including adding Services and Routes, is made via requests on to the
Step 1 - Create a New Service
Chose the desired Workspace in Kong Manager and navigate to the
Services tab under API Gateway.
Click the Create a New Service button to open the Create Service form.
Fill in a name and a URL for the Service.
For example, set the
test-service with the URL
Kong Manager also allows Services to be configured using Protocol,
Host, Path, and Port (optional). To configure the Service using
this method, click the Add using Protocol, Host, and Path option.
In addition, Kong Manager exposes several Advanced Fields
and their default configuration values:
Connect Timeout: 60000 (in ms)
Write Timeout: 60000 (in ms)
Read Timeout: 60000 (in ms)
Adjusting these values is optional and can be
Create the Service by clicking the Create Service button at the bottom of
If successful, you will be automatically redirected to the
Service’s Overview page.
The Service Overview page displays
information and Activity on the Service, as well as any Routes or
Plugins that have been connected to the Service.
Step 2 - Create a New Route attached to the Service
From the Service Overview page accessed in
Step 1, click the Create New Route button
located in the Routes tab at the bottom of the page.
To create a Route you must provide the Service
will be automatically filled out if the form was accessed via the
Service Overview page.
If this field is not automatically filled, the Service Id can be
found via the Services Overview page, accessed by clicking on the Services
tab on the side navigation and then clicking the clipboard icon next to the
desired Service’s Id field.
The Route will also need a name, and at least one of the following fields:
Host, Methods, or Paths
To continue with the Mockbin example,
name the Route
test-route with the Host
example.com. Once completed,
click the Create Route button at the bottom of the form.
If created successfully, the page will be automatically redirected back to
the Service Overview page, and the new Route will now appear under the
Step 3 - Test the new Service and Route
Issue the following cURL request to verify that Kong is properly forwarding
requests to the Service. Note that by default Kong handles proxy requests on
$ curl -i -X GET \
--url http://localhost:8000/ \
--header 'Host: example.com'
A successful response means Kong is now forwarding requests made to
http://localhost:8000 to the Service URL configured in
Step 1, and is forwarding the response back.
Kong knows to do this through the header defined in the above cURL request.