Proxy and Test a Service
Create a Konnect Gateway service to proxy your APIs. In this guide, you will create, proxy, and test a gateway service using Gateway Manager in Konnect.
When you create a service, you also specify the route to it. This route, combined with the proxy URL for the service, will lead to the endpoint specified in the API product deployment.
Prerequisites
If you’re following the Konnect quickstart guide, make sure you have configured a data plane node.
Implement a Gateway service
In the Gateway Manager, select the Default control plane and follow these steps:
-
Select Gateway Services from the side navigation bar, then New Gateway Service.
-
From the Add a Gateway Service dialog, create a new service:
-
Enter a unique name for the Gateway service, or specify a Gateway service that doesn’t yet have a version connected to it.
For the purpose of this example, enter
example_gateway_service
.The name can be any string containing letters, numbers, or the following characters:
.
,-
,_
,~
, or:
. Do not use spaces.For example, you can use
example_service
,ExampleService
,Example-Service
. However,Example Service
is invalid. -
In the add using upstream URL field, enter
http://httpbin.org
. -
Use the defaults for the remaining fields.
-
Click Save.
-
-
Add a route to your service implementation by clicking the Add a Route button now visible from the Gateway service dashboard.
For this example, enter the following:
-
Name:
httpbin
-
Protocols:
HTTP
,HTTPS
-
Path(s):
/mock
-
Name:
-
Click Save.
Verify the implementation
If you used the Docker script to connect a data plane
earlier in Configure a data plane node,
your default proxy URL is localhost:8000
.
Enter the proxy URL into your browser’s address bar and append the route path you just set. The final URL should look something like this:
http://localhost:8000/mock
If successful, you should see the homepage for httpbin.org
. In the Gateway Manager you will now see a 200 responses recorded in the Analytics tab.
And that’s it! You have your first service set up, running, and routing traffic proxied through a Kong Gateway data plane node.
Summary and next steps
To summarize, in this topic you:
- Implemented a Gateway service
example_gateway_service
and the route/mock
. This means if an HTTP request is sent to the Kong Gateway node and it matches route/mock
, that request is sent tohttp://httpbin.org
. - Abstracted a backend/upstream service and put a route of your choice on the front end, which you can now give to clients to make requests.