diff --git a/app/_how-tos/get-started-with-gateway.md b/app/_how-tos/get-started-with-gateway.md index 9f3f605b..f9327db7 100644 --- a/app/_how-tos/get-started-with-gateway.md +++ b/app/_how-tos/get-started-with-gateway.md @@ -114,6 +114,11 @@ entities: Using the Service and Route, you can now access `https://httpbin.konghq.com/` using `http://localhost:8000/mock`. +{: data-deployment-topology="on-prem" } + +Using the Service and Route, you can now +access `https://httpbin.konghq.com/` using `$KONNECT_PROXY_URL/mock`. +{: data-deployment-topology="konnect" } Httpbin provides an `/anything` resource which will return information about requests made to it. Proxy a request through {{site.base_gateway}} to the `/anything` resource: @@ -121,6 +126,13 @@ Proxy a request through {{site.base_gateway}} to the `/anything` resource: ```sh curl -X GET http://localhost:8000/mock/anything ``` +{: data-deployment-topology="on-prem" } + +```sh +curl -X GET $KONNECT_PROXY_URL/mock/anything +``` +{: data-deployment-topology="konnect" } + ## 4. Enable rate limiting @@ -189,8 +201,15 @@ the returned headers. The Proxy Cache plugin returns status information headers prefixed with `X-Cache`, so you can use `grep` to filter for that information: ```sh -for _ in {1..6}; do curl -s -i localhost:8000/mock/anything; echo; sleep 1; done | grep -E 'X-Cache|HTTP/1.1' +for _ in {1..6}; do curl -s -i http://localhost:8000/mock/anything; echo; sleep 1; done | grep -E 'X-Cache|HTTP/1.1' ``` +{: data-deployment-topology="on-prem" } + +```sh +for _ in {1..6}; do curl -s -i $KONNECT_PROXY_URL/mock/anything; echo; sleep 1; done | grep -E 'X-Cache|HTTP/1.1' +``` +{: data-deployment-topology="konnect" } + On the initial request, there should be no cached responses, and the headers will indicate this with `X-Cache-Status: Miss`: @@ -269,6 +288,12 @@ Only specify a key for testing or when migrating existing systems. ```sh curl -i http://localhost:8000/mock/anything ``` +{: data-deployment-topology="on-prem" } + +```sh +curl -i $KONNECT_PROXY_URL/mock/anything +``` +{: data-deployment-topology="konnect" } Since you enabled key authentication globally, you will receive an unauthorized response: @@ -287,6 +312,12 @@ Now, let's send a request with the valid key in the `apikey` header: curl -i http://localhost:8000/mock/anything \ -H 'apikey:top-secret-key' ``` +{: data-deployment-topology="on-prem" } + +```sh +curl -i $KONNECT_PROXY_URL/mock/anything +``` +{: data-deployment-topology="konnect" } You will receive a `200 OK` response. @@ -340,6 +371,12 @@ You will see the hostname change between `httpbin` and `httpbun`: ```sh curl -s http://localhost:8000/mock/headers -H 'apikey:top-secret-key' | grep -i -A1 '"host"' ``` +{: data-deployment-topology="on-prem" } + +```sh +curl -s $KONNECT_PROXY_URL/mock/headers -H 'apikey:top-secret-key' | grep -i -A1 '"host"' +``` +{: data-deployment-topology="konnect" } Since the Proxy Cache plugin is configured with a time-to-live of 5 seconds, the host will take at least 5 seconds to change. diff --git a/app/_includes/prereqs/products/konnect.md b/app/_includes/prereqs/products/konnect.md index 6b02fa81..197d948d 100644 --- a/app/_includes/prereqs/products/konnect.md +++ b/app/_includes/prereqs/products/konnect.md @@ -7,16 +7,16 @@ If you don't have a Konnect account, you can get started quickly with our [onboa 1. The following Konnect items are required to complete this tutorial: - * Personal access token (PAT): Create a new personal access token by opening the [Konnect PAT page](https://cloud.konghq.com/global/account/tokens) and selecting **Generate Token**. - * Control Plane: You can use an existing Control Plane or [create a new one](https://cloud.konghq.com/us/gateway-manager/create-control-plane) to use for this tutorial. - * Control Plane ID: You can see your Control Plane ID by selecting a Control Plane from the [Gateway Manager](https://cloud.konghq.com/us/gateway-manager/) in Konnect. - * A Data Plane node running on `localhost:8000` (default): You can set up Data Plane nodes for your Control Plane from the [Gateway Manager](https://cloud.konghq.com/us/gateway-manager/) in Konnect. + * Personal access token (PAT): Create a new personal access token by opening the [Konnect PAT page](https://cloud.konghq.com/global/account/tokens) and selecting **Generate Token**. + * Control Plane Name: You can use an existing Control Plane or [create a new one](https://cloud.konghq.com/us/gateway-manager/create-control-plane) to use for this tutorial. + * Konnect Proxy URL: By default, a self-hosted Data Plane uses `http://localhost:8000`. You can set up Data Plane nodes for your Control Plane from the [Gateway Manager](https://cloud.konghq.com/us/gateway-manager/) in Konnect. -2. Set the personal access token and the Control Plane ID as environment variables: +2. Set the personal access token, the Control Plane Name and the Konnect proxy url as environment variables: ```sh export KONNECT_TOKEN=your-token export KONNECT_CP_NAME=your-control-plane-name + export KONNECT_PROXY_URL=konnect-proxy-url ``` {% endcapture %}