<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AnushaPalle</title>
    <description>The latest articles on DEV Community by AnushaPalle (@anushapalle).</description>
    <link>https://dev.to/anushapalle</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F928810%2F7ed21bc2-7aa9-47fd-a12e-b517f5e821d4.png</url>
      <title>DEV Community: AnushaPalle</title>
      <link>https://dev.to/anushapalle</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anushapalle"/>
    <language>en</language>
    <item>
      <title>Kong Transformations and Observability with Zipkin, Prometheus and ELK</title>
      <dc:creator>AnushaPalle</dc:creator>
      <pubDate>Fri, 27 Nov 2026 04:27:22 +0000</pubDate>
      <link>https://dev.to/anushapalle/kong-transformations-and-observability-with-zipkin-prometheus-and-elk-11hk</link>
      <guid>https://dev.to/anushapalle/kong-transformations-and-observability-with-zipkin-prometheus-and-elk-11hk</guid>
      <description>&lt;p&gt;&lt;strong&gt;Meta description:&lt;/strong&gt; Change requests and responses on the fly, then trace, measure and log every call that passes through Kong.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Request and response transformer plugins&lt;/li&gt;
&lt;li&gt;Correlation IDs&lt;/li&gt;
&lt;li&gt;Tracing with Zipkin, metrics with Prometheus, logs with Elasticsearch and Kibana&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Part 1: Transformations
&lt;/h2&gt;

&lt;p&gt;Sometimes your backend and your clients disagree about headers or fields. Instead of changing and redeploying code, adjust traffic at the gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Request transformer
&lt;/h3&gt;

&lt;p&gt;Modifies the request &lt;strong&gt;before&lt;/strong&gt; it reaches your service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/services/alpha-service/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;request-transformer \
  --data config.add.headers=X-Source:kong \
  --data config.remove.headers=X-Debug \
  --data config.rename.headers=X-Old:X-New \
  --data config.add.querystring=version:2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add an internal header your backend needs&lt;/li&gt;
&lt;li&gt;Strip headers clients shouldn't send&lt;/li&gt;
&lt;li&gt;Add a query parameter&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Response transformer
&lt;/h3&gt;

&lt;p&gt;Modifies the response &lt;strong&gt;before&lt;/strong&gt; it reaches the client.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/services/alpha-service/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;response-transformer \
  --data config.add.headers=X-Served-By:kong \
  --data config.remove.headers=Server \
  --data config.remove.json=internalNotes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Handy for hiding internal fields or adding cache and security headers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Correlation ID
&lt;/h3&gt;

&lt;p&gt;A tiny plugin with a big payoff. It gives every request a unique ID you can follow through logs and services.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;correlation-id \
  --data config.header_name=X-Request-Id \
  --data config.generator=uuid \
  --data config.echo_downstream=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;echo_downstream=true&lt;/code&gt; returns the ID to the client too, so a user reporting a problem can quote it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2: Observability
&lt;/h2&gt;

&lt;p&gt;You can't fix what you can't see. Three complementary views:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Pillar&lt;/th&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Is something wrong right now?&lt;/td&gt;
&lt;td&gt;Metrics&lt;/td&gt;
&lt;td&gt;Prometheus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where is the time going?&lt;/td&gt;
&lt;td&gt;Traces&lt;/td&gt;
&lt;td&gt;Zipkin&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What exactly happened in that request?&lt;/td&gt;
&lt;td&gt;Logs&lt;/td&gt;
&lt;td&gt;Elasticsearch + Kibana&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Traces with Zipkin
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;zipkin \
  --data config.http_endpoint=http://zipkin:9411/api/v2/spans \
  --data config.sample_ratio=1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sample_ratio=1&lt;/code&gt; traces every request, fine for learning. In production use something like &lt;code&gt;0.1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Run Zipkin with Docker (&lt;code&gt;openzipkin/zipkin&lt;/code&gt;), open &lt;code&gt;http://localhost:9411&lt;/code&gt;, find a trace and see how long Kong took versus your backend.&lt;/p&gt;

&lt;h3&gt;
  
  
  Metrics with Prometheus
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/plugins --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;prometheus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kong then exposes request counts by status code, latency, bandwidth and upstream health at &lt;code&gt;http://localhost:8001/metrics&lt;/code&gt;. Point Prometheus at it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;scrape_configs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;job_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;metrics_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/metrics&lt;/span&gt;
    &lt;span class="na"&gt;static_configs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"kong:8001"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Graph request rate and error rate, or alert when 5xx responses climb.&lt;/p&gt;

&lt;h3&gt;
  
  
  Logs with Elasticsearch and Kibana
&lt;/h3&gt;

&lt;p&gt;Kong's logging plugins (for example &lt;code&gt;http-log&lt;/code&gt;) send one JSON document per request to an endpoint you choose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http-log \
  --data config.http_endpoint=http://logstash:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A minimal Logstash pipeline stores them in Elasticsearch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="na"&gt;input  { http { port&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt; &lt;span class="n"&gt;codec&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="na"&gt;output { elasticsearch { hosts&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"http://elasticsearch:9200"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"kong-logs-%{+YYYY.MM.dd}"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;strong&gt;Kibana&lt;/strong&gt;, create a data view for &lt;code&gt;kong-logs-*&lt;/code&gt; and search things like "all 500 responses on &lt;code&gt;/alpha&lt;/code&gt; in the last hour". Each entry includes route, consumer, status and latencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the pieces work together
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;metric&lt;/strong&gt; alert says the error rate rose.&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;Kibana&lt;/strong&gt; and filter logs for status 500.&lt;/li&gt;
&lt;li&gt;Copy the &lt;strong&gt;correlation ID&lt;/strong&gt; from a failing entry.&lt;/li&gt;
&lt;li&gt;Find the same request in &lt;strong&gt;Zipkin&lt;/strong&gt; and see which hop was slow.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The correlation ID ties all three together, so always enable it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Tracing 100% of traffic in production.&lt;/li&gt;
&lt;li&gt;Forgetting that transformers run in a defined order; test the final result.&lt;/li&gt;
&lt;li&gt;Logging sensitive headers or bodies into Elasticsearch.&lt;/li&gt;
&lt;li&gt;Leaving metrics and admin endpoints open to the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Transformer plugins adapt traffic &lt;strong&gt;without redeploying code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A correlation ID is the glue between metrics, traces and logs.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;metrics to notice, traces to locate, logs to understand.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The gateway is the ideal place to start observability, because every request passes through it.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Series recap
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Post&lt;/th&gt;
&lt;th&gt;Topic&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;What a gateway is, Kong setup with Docker&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Services, Routes, Consumers, Kong Manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Upstreams, Targets, load balancing, health checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Authentication and traffic-control plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Transformations and observability&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>api</category>
      <category>architecture</category>
      <category>devops</category>
      <category>monitoring</category>
    </item>
    <item>
      <title>Kong Plugins for Authentication and Traffic Control</title>
      <dc:creator>AnushaPalle</dc:creator>
      <pubDate>Fri, 27 Nov 2026 04:26:49 +0000</pubDate>
      <link>https://dev.to/anushapalle/kong-plugins-for-authentication-and-traffic-control-5h3</link>
      <guid>https://dev.to/anushapalle/kong-plugins-for-authentication-and-traffic-control-5h3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Meta description:&lt;/strong&gt; Secure and throttle your APIs with Kong: key-auth, Basic auth, JWT, ACL, rate limiting, request size limiting and IP restriction.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How plugins work and where they apply&lt;/li&gt;
&lt;li&gt;Authentication vs authorization&lt;/li&gt;
&lt;li&gt;Ways to authenticate&lt;/li&gt;
&lt;li&gt;How to limit traffic fairly&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is a plugin?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;plugin&lt;/strong&gt; adds behavior to the request/response flow without changing your backend code. You can attach it at different scopes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Applies to&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Global&lt;/td&gt;
&lt;td&gt;Every request through Kong&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service&lt;/td&gt;
&lt;td&gt;All routes of one service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Route&lt;/td&gt;
&lt;td&gt;Only one route&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consumer&lt;/td&gt;
&lt;td&gt;Only one caller&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When scopes overlap, the more specific one wins.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1: Authentication, "who are you?"
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Key authentication (&lt;code&gt;key-auth&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The simplest approach. The client sends a secret key in a header.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Enable on a service&lt;/span&gt;
curl -X POST http://localhost:8001/services/alpha-service/plugins --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;key-auth

&lt;span class="c"&gt;# 2. Create a key for the consumer&lt;/span&gt;
curl -X POST http://localhost:8001/consumers/asha/key-auth --data &lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;asha-secret-key

&lt;span class="c"&gt;# 3. Call&lt;/span&gt;
curl -i http://localhost:8000/alpha/hello                                &lt;span class="c"&gt;# 401&lt;/span&gt;
curl -i http://localhost:8000/alpha/hello -H &lt;span class="s1"&gt;'apikey: asha-secret-key'&lt;/span&gt;   &lt;span class="c"&gt;# 200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without a key, Kong answers &lt;strong&gt;401&lt;/strong&gt; and your backend never sees the request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic authentication (&lt;code&gt;basic-auth&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Username and password in the &lt;code&gt;Authorization&lt;/code&gt; header. Simple and widely supported, but use it only over HTTPS.&lt;/p&gt;

&lt;h3&gt;
  
  
  JWT authentication (&lt;code&gt;jwt&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The client sends a signed token: &lt;code&gt;Authorization: Bearer &amp;lt;token&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/services/alpha-service/plugins --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;jwt
curl -X POST http://localhost:8001/consumers/asha/jwt     &lt;span class="c"&gt;# returns key + secret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kong checks the token's signature with the consumer's secret and checks it hasn't expired. The token's &lt;code&gt;iss&lt;/code&gt; claim must equal the consumer's JWT &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;key-auth&lt;/td&gt;
&lt;td&gt;Simple service-to-service or partner access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;basic-auth&lt;/td&gt;
&lt;td&gt;Quick internal tools (over HTTPS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;jwt&lt;/td&gt;
&lt;td&gt;User sessions, stateless tokens with expiry&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Part 2: Authorization, "what may you do?" (&lt;code&gt;acl&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Authentication identifies the caller. &lt;strong&gt;Authorization&lt;/strong&gt; decides what they can access. Kong's ACL plugin uses &lt;strong&gt;groups&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# put the consumer in a group&lt;/span&gt;
curl -X POST http://localhost:8001/consumers/asha/acls --data &lt;span class="nv"&gt;group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;shoppers

&lt;span class="c"&gt;# allow only admins on a route&lt;/span&gt;
curl -X POST http://localhost:8001/routes/alpha-write/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;acl --data &lt;span class="s1"&gt;'config.allow=admins'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ACL plugin needs an authentication plugin on the same route, because it has to know who the consumer is.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;401 vs 403.&lt;/strong&gt; 401 means "I don't know who you are". 403 means "I know you, but you may not do this."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Part 3: Traffic control, "how much?"
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Rate limiting
&lt;/h3&gt;

&lt;p&gt;Protects your service from abuse and accidental loops.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/services/alpha-service/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rate-limiting \
  --data config.minute=30 \
  --data config.policy=local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Responses include headers such as &lt;code&gt;X-RateLimit-Remaining-Minute&lt;/code&gt;. After the limit, Kong returns &lt;strong&gt;429 Too Many Requests&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Which &lt;code&gt;policy&lt;/code&gt;?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;local&lt;/code&gt;: counters in each Kong node's memory (fast, but each node counts alone)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;redis&lt;/code&gt;: shared counters across nodes (accurate across a cluster)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also attach a rate limit to a &lt;strong&gt;consumer&lt;/strong&gt;, so a premium customer gets 1000/min and a free one gets 30/min.&lt;/p&gt;

&lt;h3&gt;
  
  
  Request size limiting
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/services/alpha-service/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;request-size-limiting \
  --data config.allowed_payload_size=1 \
  --data config.size_unit=megabytes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Oversized bodies are rejected with &lt;strong&gt;413&lt;/strong&gt; before they reach your backend.&lt;/p&gt;

&lt;h3&gt;
  
  
  IP restriction
&lt;/h3&gt;

&lt;p&gt;Allow or deny by address, handy for admin routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST http://localhost:8001/routes/alpha-write/plugins \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ip-restriction --data &lt;span class="s1"&gt;'config.allow=10.0.0.0/8'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A typical policy for one API
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Route&lt;/th&gt;
&lt;th&gt;Plugins&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GET /items&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;auth, group &lt;code&gt;readers&lt;/code&gt; or &lt;code&gt;admins&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /items&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;auth, group &lt;code&gt;admins&lt;/code&gt; only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/orders&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;auth, ACL, rate limit 30/min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;everything&lt;/td&gt;
&lt;td&gt;request size limit 1 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Adding &lt;code&gt;acl&lt;/code&gt; without an authentication plugin.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;rate-limiting&lt;/code&gt; with &lt;code&gt;local&lt;/code&gt; policy on several Kong nodes and expecting a global total.&lt;/li&gt;
&lt;li&gt;Committing real secrets and keys to git. Use environment variables or a secret manager.&lt;/li&gt;
&lt;li&gt;Confusing 401 and 403 when debugging.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Plugins give you security and limits &lt;strong&gt;without touching backend code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Authenticate first, authorize second.&lt;/li&gt;
&lt;li&gt;Rate limits and size limits are cheap protection; set them early.&lt;/li&gt;
&lt;li&gt;Attach plugins at the narrowest scope that makes sense.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Transformations and observability.&lt;/p&gt;

</description>
      <category>api</category>
      <category>authentication</category>
      <category>backend</category>
      <category>security</category>
    </item>
    <item>
      <title>Kong Upstreams, Targets, Load Balancing and Health Checks</title>
      <dc:creator>AnushaPalle</dc:creator>
      <pubDate>Fri, 27 Nov 2026 04:26:04 +0000</pubDate>
      <link>https://dev.to/anushapalle/kong-upstreams-targets-load-balancing-and-health-checks-4ma</link>
      <guid>https://dev.to/anushapalle/kong-upstreams-targets-load-balancing-and-health-checks-4ma</guid>
      <description>&lt;p&gt;&lt;strong&gt;Meta description:&lt;/strong&gt; Spread traffic across several backend instances and automatically stop sending requests to failing ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Upstreams and Targets&lt;/li&gt;
&lt;li&gt;Kong's load balancing algorithms&lt;/li&gt;
&lt;li&gt;Active and passive health checks&lt;/li&gt;
&lt;li&gt;How to test failover yourself&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why one backend isn't enough
&lt;/h2&gt;

&lt;p&gt;A single instance of your API is a single point of failure, and it can only handle so much load. In practice you run &lt;strong&gt;several copies&lt;/strong&gt;. Kong needs to know:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to &lt;strong&gt;distribute&lt;/strong&gt; requests across them (load balancing)&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;avoid&lt;/strong&gt; the broken ones (health checks)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The concepts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Upstream:&lt;/strong&gt; a virtual name that stands for a &lt;em&gt;pool&lt;/em&gt; of backends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target:&lt;/strong&gt; one real instance in the pool (&lt;code&gt;host:port&lt;/code&gt;), with a &lt;strong&gt;weight&lt;/strong&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                          ┌→ Target 1: alpha1:8080
Kong → Upstream "alpha-upstream" ┤
                          └→ Target 2: alpha2:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting it up
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Create the upstream&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X POST http://localhost:8001/upstreams --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha-upstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Add targets&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X POST http://localhost:8001/upstreams/alpha-upstream/targets \
  --data &lt;span class="nv"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha1:8080 --data &lt;span class="nv"&gt;weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;100

curl -i -X POST http://localhost:8001/upstreams/alpha-upstream/targets \
  --data &lt;span class="nv"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha2:8080 --data &lt;span class="nv"&gt;weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Point your Service at the upstream name&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X PATCH http://localhost:8001/services/alpha-service \
  --data &lt;span class="nv"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha-upstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Service no longer points at one server. Its host is the upstream, and Kong picks a target for each request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Load balancing algorithms
&lt;/h2&gt;

&lt;p&gt;Set it on the upstream with &lt;code&gt;algorithm&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Algorithm&lt;/th&gt;
&lt;th&gt;How it chooses&lt;/th&gt;
&lt;th&gt;Good for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;round-robin&lt;/code&gt; (default)&lt;/td&gt;
&lt;td&gt;Takes turns, respecting weights&lt;/td&gt;
&lt;td&gt;General use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;least-connections&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Target with the fewest active connections&lt;/td&gt;
&lt;td&gt;Requests of uneven duration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;consistent-hashing&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Same key (header, cookie, IP) always lands on the same target&lt;/td&gt;
&lt;td&gt;Caching, session affinity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;latency&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Favors the fastest-responding target&lt;/td&gt;
&lt;td&gt;Mixed capacity or regions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X PATCH http://localhost:8001/upstreams/alpha-upstream \
  --data &lt;span class="nv"&gt;algorithm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;least-connections
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Weights for gradual releases
&lt;/h3&gt;

&lt;p&gt;Give the new version &lt;code&gt;weight=10&lt;/code&gt; and the old one &lt;code&gt;weight=90&lt;/code&gt;. About 10% of traffic reaches the new version, so you can test it with real users before switching fully.&lt;/p&gt;

&lt;h2&gt;
  
  
  Health checks
&lt;/h2&gt;

&lt;p&gt;Without health checks, Kong keeps sending requests to a dead instance and users see errors. Kong has two kinds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Active health checks
&lt;/h3&gt;

&lt;p&gt;Kong &lt;strong&gt;probes&lt;/strong&gt; each target on a schedule.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X PATCH http://localhost:8001/upstreams/alpha-upstream \
  --data healthchecks.active.type=http \
  --data healthchecks.active.http_path=/health \
  --data healthchecks.active.healthy.interval=5 \
  --data healthchecks.active.healthy.successes=2 \
  --data healthchecks.active.unhealthy.interval=5 \
  --data healthchecks.active.unhealthy.http_failures=3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meaning: every 5 seconds, call &lt;code&gt;GET /health&lt;/code&gt;. After 3 failures mark the target unhealthy. After 2 successes mark it healthy again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passive health checks
&lt;/h3&gt;

&lt;p&gt;Kong &lt;strong&gt;watches real traffic&lt;/strong&gt;. If a target returns too many errors or timeouts, it is marked unhealthy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;--data healthchecks.passive.unhealthy.http_failures=3
--data healthchecks.passive.unhealthy.timeouts=3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Active&lt;/th&gt;
&lt;th&gt;Passive&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Needs extra probe traffic&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Detects a problem before users do&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No, it reacts to real failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can bring a target back&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;No&lt;/strong&gt;, it only marks unhealthy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Use &lt;strong&gt;both&lt;/strong&gt;: passive reacts instantly, active restores recovered targets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try the failover yourself
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Run two copies of your API, &lt;code&gt;alpha1&lt;/code&gt; and &lt;code&gt;alpha2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Call the route repeatedly:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="k"&gt;for&lt;/span&gt; i &lt;span class="k"&gt;in&lt;/span&gt; 1 2 3 4 5 6&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; curl -s http://localhost:8000/alpha/hello&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Responses should alternate between the two instances.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stop one instance: &lt;code&gt;docker stop alpha2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;After a few probe cycles, every request succeeds from &lt;code&gt;alpha1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Check Kong's view:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   curl -s http://localhost:8001/upstreams/alpha-upstream/health &lt;span class="o"&gt;|&lt;/span&gt; jq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;alpha2&lt;/code&gt; shows as &lt;code&gt;UNHEALTHY&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start it again (&lt;code&gt;docker start alpha2&lt;/code&gt;) and watch it return to &lt;code&gt;HEALTHY&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Forgetting to set the Service host to the &lt;strong&gt;upstream name&lt;/strong&gt;. Kong then ignores your upstream.&lt;/li&gt;
&lt;li&gt;Having no real &lt;code&gt;/health&lt;/code&gt; endpoint on the backend. If it always returns 200, the probe proves nothing.&lt;/li&gt;
&lt;li&gt;Using only passive checks and expecting recovery.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Upstream = pool, Target = member.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Algorithms decide &lt;em&gt;who gets the next request&lt;/em&gt;; weights control the &lt;em&gt;share&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Health checks give you automatic failover with nobody on call.&lt;/li&gt;
&lt;li&gt;Always test by actually stopping an instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Authentication and traffic-control plugins.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>devops</category>
      <category>networking</category>
    </item>
    <item>
      <title>Kong Services, Routes, Consumers and Kong Manager Explained</title>
      <dc:creator>AnushaPalle</dc:creator>
      <pubDate>Fri, 27 Nov 2026 04:24:44 +0000</pubDate>
      <link>https://dev.to/anushapalle/kong-services-routes-consumers-and-kong-manager-explained-fmi</link>
      <guid>https://dev.to/anushapalle/kong-services-routes-consumers-and-kong-manager-explained-fmi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Meta description:&lt;/strong&gt; Understand Kong's core objects by connecting a REST API to the gateway and exploring the Kong Manager UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What Services, Routes and Consumers are, and how they relate&lt;/li&gt;
&lt;li&gt;How to publish an API through Kong&lt;/li&gt;
&lt;li&gt;How to use Kong Manager&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A sample REST API
&lt;/h2&gt;

&lt;p&gt;You need a backend to forward to. Any REST API works. Here, assume a small API called &lt;code&gt;alpha&lt;/code&gt; running at &lt;code&gt;http://alpha:8080&lt;/code&gt; on the same Docker network as Kong, with an endpoint &lt;code&gt;GET /hello&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three core objects
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client → [ Route: "which requests?" ] → [ Service: "where to?" ] → your API
                      ↑
              Consumer: "who is calling?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1. Service: where the traffic goes
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Service&lt;/strong&gt; describes your backend: protocol, host, port and path.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X POST http://localhost:8001/services \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha-service \
  --data &lt;span class="nv"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://alpha:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nobody can reach it yet. A Service only describes the destination.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Route: which requests go there
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Route&lt;/strong&gt; is a matching rule: paths, HTTP methods, hosts or headers. It connects incoming requests to a Service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X POST http://localhost:8001/services/alpha-service/routes \
  --data &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;alpha-route \
  --data &lt;span class="s1"&gt;'paths[]=/alpha'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i http://localhost:8000/alpha/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kong matched &lt;code&gt;/alpha&lt;/code&gt;, forwarded the request to the alpha API and returned the response.&lt;/p&gt;

&lt;h4&gt;
  
  
  The &lt;code&gt;strip_path&lt;/code&gt; setting
&lt;/h4&gt;

&lt;p&gt;By default Kong &lt;strong&gt;removes&lt;/strong&gt; the matched path before forwarding. So &lt;code&gt;/alpha/hello&lt;/code&gt; reaches your backend as &lt;code&gt;/hello&lt;/code&gt;. If your backend expects &lt;code&gt;/alpha/hello&lt;/code&gt;, set &lt;code&gt;strip_path=false&lt;/code&gt;. This is a very common beginner surprise.&lt;/p&gt;

&lt;h4&gt;
  
  
  Routes can be specific
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;--data &lt;span class="s1"&gt;'paths[]=/products'&lt;/span&gt; --data &lt;span class="s1"&gt;'methods[]=GET'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can have separate Routes for &lt;code&gt;GET /products&lt;/code&gt; and &lt;code&gt;POST /products&lt;/code&gt;, each with different rules, such as stricter security for writes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Consumer: who is calling
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Consumer&lt;/strong&gt; represents a user or application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -X POST http://localhost:8001/consumers --data &lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;asha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A consumer alone does nothing. It becomes useful when you attach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Credentials (API keys, JWT)&lt;/li&gt;
&lt;li&gt;Group membership (for authorization)&lt;/li&gt;
&lt;li&gt;Per-consumer policies (like a custom rate limit)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'll do this in the plugin posts.&lt;/p&gt;

&lt;h2&gt;
  
  
  How they relate
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Object&lt;/th&gt;
&lt;th&gt;Question it answers&lt;/th&gt;
&lt;th&gt;Relationship&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Service&lt;/td&gt;
&lt;td&gt;Where does it go?&lt;/td&gt;
&lt;td&gt;One service can have &lt;strong&gt;many&lt;/strong&gt; routes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Route&lt;/td&gt;
&lt;td&gt;Which requests?&lt;/td&gt;
&lt;td&gt;Each route belongs to &lt;strong&gt;one&lt;/strong&gt; service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consumer&lt;/td&gt;
&lt;td&gt;Who is calling?&lt;/td&gt;
&lt;td&gt;Linked to credentials and plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Kong Manager, the web UI
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;http://localhost:8002&lt;/code&gt;. You'll see the &lt;strong&gt;default workspace&lt;/strong&gt;. From the UI you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See all Services, Routes and Consumers&lt;/li&gt;
&lt;li&gt;Create or edit them with forms&lt;/li&gt;
&lt;li&gt;Inspect the plugins attached to each&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good for: learning, exploring, quick checks while debugging.&lt;/p&gt;

&lt;p&gt;Avoid in real projects: making important changes &lt;strong&gt;only&lt;/strong&gt; in the UI. They aren't recorded in version control. Prefer scripts, Admin API calls or declarative config files so your setup is repeatable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Useful inspection commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s http://localhost:8001/services  &lt;span class="o"&gt;|&lt;/span&gt; jq
curl -s http://localhost:8001/routes    &lt;span class="o"&gt;|&lt;/span&gt; jq
curl -s http://localhost:8001/consumers &lt;span class="o"&gt;|&lt;/span&gt; jq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Creating a Service but no Route, then wondering why you get "no Route matched".&lt;/li&gt;
&lt;li&gt;Surprise path changes because of &lt;code&gt;strip_path&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;localhost&lt;/code&gt; as the service host. Inside Docker, &lt;code&gt;localhost&lt;/code&gt; means the Kong container itself. Use the container or service name.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Service = destination, Route = matching rule, Consumer = caller.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;One Service, many Routes is a very common pattern.&lt;/li&gt;
&lt;li&gt;Kong Manager is great for learning, but keep real configuration reproducible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Upstreams, Targets, load balancing and health checks.&lt;/p&gt;

</description>
      <category>api</category>
      <category>architecture</category>
      <category>backend</category>
      <category>devops</category>
    </item>
    <item>
      <title>What Is an API Gateway? Getting Started with Kong Using Docker</title>
      <dc:creator>AnushaPalle</dc:creator>
      <pubDate>Fri, 27 Nov 2026 04:23:00 +0000</pubDate>
      <link>https://dev.to/anushapalle/what-is-an-api-gateway-getting-started-with-kong-using-docker-30c0</link>
      <guid>https://dev.to/anushapalle/what-is-an-api-gateway-getting-started-with-kong-using-docker-30c0</guid>
      <description>&lt;h1&gt;
  
  
  What Is an API Gateway? Getting Started with Kong Using Docker
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Meta description:&lt;/strong&gt; A beginner's introduction to API gateways and Kong, with a working Docker setup and your first request.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you'll learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What an API gateway is and why REST APIs need one&lt;/li&gt;
&lt;li&gt;How Kong is structured&lt;/li&gt;
&lt;li&gt;How to run Kong locally with Docker and check that it works&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The problem: too many front doors
&lt;/h2&gt;

&lt;p&gt;Say you've built a few REST services: &lt;code&gt;/products&lt;/code&gt;, &lt;code&gt;/orders&lt;/code&gt; and &lt;code&gt;/users&lt;/code&gt;. Each service must handle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication (who is calling?)&lt;/li&gt;
&lt;li&gt;Rate limiting (stop abuse)&lt;/li&gt;
&lt;li&gt;Logging and monitoring&lt;/li&gt;
&lt;li&gt;HTTPS, CORS, request size limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If every team re-implements these, you get duplicated code, inconsistent security and a lot of maintenance.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;API gateway&lt;/strong&gt; solves this. It is a single entry point that sits in front of all your services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client  →  Kong (gateway)  →  Service A
                            →  Service B
                            →  Service C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt; think of an airport. Passengers (requests) don't walk straight onto planes (services). They go through check-in, security and boarding. The airport handles the checks once, so the planes don't have to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meet Kong
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Kong&lt;/strong&gt; is a popular open-source API gateway built on NGINX. It is fast, and you extend it with &lt;strong&gt;plugins&lt;/strong&gt; (security, traffic control, transformations, logging).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Who uses it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;8000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Proxy&lt;/td&gt;
&lt;td&gt;Your API clients send traffic here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;8001&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Admin API&lt;/td&gt;
&lt;td&gt;You, to configure Kong&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;8002&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Kong Manager&lt;/td&gt;
&lt;td&gt;You, a web UI for the same configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Remember this split. &lt;strong&gt;Clients use 8000, administrators use 8001/8002.&lt;/strong&gt; In production, the admin ports must never be public.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two ways Kong stores its config
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;With a database (PostgreSQL):&lt;/strong&gt; you change config live through the Admin API. This is what we use for learning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DB-less (declarative):&lt;/strong&gt; the config is a YAML file loaded at startup. Great for version control and automation.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Run Kong with Docker
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;docker-compose.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;kong-db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:13&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_DB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;healthcheck&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CMD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"pg_isready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-U"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kong"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;5s&lt;/span&gt;
      &lt;span class="na"&gt;retries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

  &lt;span class="na"&gt;kong-migrations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong:3.7&lt;/span&gt;
    &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong migrations bootstrap&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;&amp;amp;kong-db&lt;/span&gt;
      &lt;span class="na"&gt;KONG_DATABASE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
      &lt;span class="na"&gt;KONG_PG_HOST&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong-db&lt;/span&gt;
      &lt;span class="na"&gt;KONG_PG_USER&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
      &lt;span class="na"&gt;KONG_PG_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;kong-db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;service_healthy&lt;/span&gt;

  &lt;span class="na"&gt;kong&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kong:3.7&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;*kong-db&lt;/span&gt;
      &lt;span class="na"&gt;KONG_PROXY_ACCESS_LOG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/dev/stdout&lt;/span&gt;
      &lt;span class="na"&gt;KONG_ADMIN_ACCESS_LOG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/dev/stdout&lt;/span&gt;
      &lt;span class="na"&gt;KONG_PROXY_ERROR_LOG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/dev/stderr&lt;/span&gt;
      &lt;span class="na"&gt;KONG_ADMIN_ERROR_LOG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/dev/stderr&lt;/span&gt;
      &lt;span class="na"&gt;KONG_ADMIN_LISTEN&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;0.0.0.0:8001&lt;/span&gt;
      &lt;span class="na"&gt;KONG_ADMIN_GUI_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http://localhost:8002&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"8000:8000"&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"8001:8001"&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"8002:8002"&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;kong-migrations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;service_completed_successfully&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check that it works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i http://localhost:8001/status
curl -i http://localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first call returns Kong's status. The second returns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"no Route matched with those values"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;That error is good news.&lt;/strong&gt; Kong is running, but you haven't told it where to send traffic yet. We do that in the next post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Exposing port 8001 publicly. Anyone who reaches it can reconfigure your gateway.&lt;/li&gt;
&lt;li&gt;Forgetting the migrations step. Kong won't start without its database tables.&lt;/li&gt;
&lt;li&gt;Confusing 8000 and 8001. 8000 is for clients, 8001 is for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An API gateway is one entry point that handles cross-cutting concerns for many services.&lt;/li&gt;
&lt;li&gt;Kong runs a proxy (8000) and an admin interface (8001, UI on 8002).&lt;/li&gt;
&lt;li&gt;Docker makes a local Kong setup a single command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Services, Routes, Consumers and Kong Manager.&lt;/p&gt;

</description>
      <category>apigateway</category>
    </item>
  </channel>
</rss>
