Estimated reading time:
You are browsing documentation for an outdated version of Kong Enterprise. Go here
to browse the documentation for the latest version.
This topic walks through the creation and configuration of a
Service and Route using Kong Manager in Kong Enterprise. To do this
using the command line, read Kong’s guide to
Configuring a Service.
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
Choose the desired Workspace in Kong Manager and navigate to the
Services tab under API Gateway.
Click the New Service button to open the Create Service dialog.
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 button.
If successful, you are 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 Create Route.
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.