Link a Konnect Service to Insomnia

Enterprise and uses: Kong Gateway Insomnia deck
Incompatible with
on-prem
Minimum Version
Insomnia - 13
TL;DR

In Insomnia, link Konnect using a Personal Access Token (PAT) and set up proxy URLs for your Gateway Service.

Prerequisites

This is a Konnect tutorial and requires a Konnect personal access token.

  1. Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.

  2. Export your token to an environment variable:

    export KONNECT_TOKEN='YOUR_KONNECT_PAT'
  3. Run the quickstart script to automatically provision a Control Plane and Data Plane, and configure your environment:

    curl -Ls https://get.konghq.com/quickstart | bash -s -- -k $KONNECT_TOKEN --deck-output

    This sets up a Konnect Control Plane named quickstart, provisions a local Data Plane, and prints out the following environment variable exports:

    export DECK_KONNECT_TOKEN=$KONNECT_TOKEN
    export DECK_KONNECT_CONTROL_PLANE_NAME=quickstart
    export KONNECT_CONTROL_PLANE_URL=https://us.api.konghq.com
    export KONNECT_PROXY_URL='http://localhost:8000'

    Copy and paste these into your terminal to configure your session.

Download and install Insomnia.

To complete this tutorial, install decK. We recommend keeping decK up to date with the latest version (1.63.0).

decK is a CLI tool for managing Kong Gateway declaratively with state files. This guide uses deck gateway apply, which directly applies entity configuration to your Gateway instance.

You can check your current decK version with deck version.

For this tutorial, you’ll need Kong Gateway entities, like Gateway Services and Routes, pre-configured. These entities are essential for Kong Gateway to function but installing them isn’t the focus of this guide. Follow these steps to pre-configure them:

  1. Run the following command:

    echo '
    _format_version: "3.0"
    services:
      - name: example-service
        url: http://httpbin.konghq.com/anything
    routes:
      - name: example-route
        paths:
        - "/anything"
        service:
          name: example-service
        protocols:
        - http
        - https
    ' | deck gateway apply -

To learn more about entities, you can read our entities documentation.

  1. In your workspace, open the Konnect tab
  2. In the Personal Access Token, paste the PAT
  3. Click Connect & Sync

In your workspace, Insomnia now displays the Konnect tab. Open the tab and click Sync. After syncing, Insomnia displays your Kong Gateway Services under the Konnect

Set the Proxy URLs

On first Sync, set the proxy URL for each Gateway Service:

  1. From your Insomnia workspace, go to the Konnect tab
  2. Select a Gateway Service: example-service in this guide.
  3. Open the Base Environment file
  4. Input the proxy URLs for the selected Gateway Service. For example-service, set proxy_host to localhost:8000

The proxy URLs depend on the type of control plane you chose. See Data Plane hosting options for details.

Insomnia never resets this setup when syncing. If you change the proxy URLs in Konnect, repeat this setup.

You are now ready to send requests from Insomnia against Routes hosted on Konnect.

Validate

  1. Select any Route from example-service
  2. Make sure the URL is http://{{ _.proxy_host }}/anything
  3. Click Send

In the Preview tab, Insomnia displays the following response:

{
	"args": {},
	"data": "",
	"files": {},
	"form": {},
	"headers": {
		"Accept": "*/*",
		"Connection": "keep-alive",
		"Host": "httpbin.konghq.com",
		"User-Agent": "insomnia/13.0.0-beta.0",
		"X-Forwarded-Host": "localhost",
		"X-Forwarded-Path": "/anything",
		"X-Forwarded-Prefix": "/anything",
		"X-Kong-Request-Id": "79f33a281e8c62316c922d0ab4fc0703"
	},
	"json": null,
	"method": "GET",
	"origin": "192.168.97.1",
	"url": "http://localhost/anything"
}

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!