Mock Recording Part 1: Starting the Kong Proxy


Mock recording allows an API Fortress user to pass API requests and responses directly into the API Fortress mocking platform. This largely eliminates the need to manually create mock response cases. To do so, we’re making use of the Kong Microgateway.

The process is divided into a few parts. Here’s how we’re going to approach it:

  1. First, we’re going to turn on the Kong proxy server.
  2. Next, we’re going to create a proxied endpoint.
  3. Finally, we’re going to push that proxied endpoint into API Fortress mocking.

A few of these steps are fairly technical, but we’re going to be as explicit as possible with the documentation and as always, if you need assistance, feel free to reach out to

What We Need:

Let’s make sure we have everything we need:

  1. An updated version of the API Fortress core/docker-compose.yml which includes the Kong section at the end. The bottom of your docker-compose should look like this:
    image: apifortress/kong
    hostname: kong.apifortress
      - kong.apifortress
    KONG_DATABASE: postgres
    KONG_PG_HOST: postgres.apifortress
    KONG_PG_USER: ********
    KONG_PG_PASSWORD: ********
    KONG_PLUGINS: fortress-http-log,file-log-extended,request-transformer,upstream-replace
    KONG_PROXY_ERROR_LOG: /dev/stdout
    - 8000:8000
    - 8001:8001

2. The initialization script,

3. The start script,

If we have all of the above, perfect! We’re ready to start. If not, feel free to reach out to to let us know what you need!

Starting Kong:

First, we need to ensure that at the API Fortress Postgres instance is running. Execute a

sudo docker ps

from the command line and ensure that it is running. The image below is the entry that you’re looking for:

Screen Shot 2018-11-08 at 10.05.35 AM

Next, we need to initialize Kong. This is done by running the previously mentioned script, Issue the following command from the command line:

sudo ./

Once Kong has finished initializing, we can proceed.

Next, we need to start the Kong container itself. We do so by issuing the following command:

sudo docker-compose up -d apifortress-kong

Once the container has finished starting, we can do a

sudo docker ps

to view the currently running containers and verify that we started it successfully.

Screen Shot 2018-11-07 at 2.09.31 PM

Finally, we can verify that the proxy is up and running by issuing the following cURL command from the command line, or an identically structured HTTP request from the HTTP client of your choice (note: replace the ‘’ component with the corresponding part of your instances URL):

curl -v

A positive response from this route indicates that the proxy server is up and running. Congratulations! You now have a live proxy server!

Our last step in the setup phase is creating an API Fortress API key. The gif below shows the process.

  1. Click the gear in the upper right corner of the view
  2. Click “API Keys” in the navigation bar on the left
  3. Click “+API Key”
  4. Name and save your API Key. It’s helpful at this point to copy the key and secret to an easy to reach location, as we’ll need it in later steps.

NEXT – Step 2: Proxying a Route