From 6c71435db1a07720efda8405d65fece9d51d929b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Tailland?= Date: Mon, 31 Aug 2026 08:26:22 +0200 Subject: [PATCH] Stop caching reads on a read-write API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proxy cache held every GET on the whole service for 60 seconds, and these APIs accept writes. Kong's proxy cache has no invalidation on write: a POST that changes a product passes through the same gateway, and the gateway goes on serving the value it captured before it, for up to a minute, with nothing in the response saying so. It produced a real wrong answer. An agent woken by a stock event read the figure from before that event and reported, in one sentence, "68 in stock, above the threshold" and "it crossed the threshold, from 68". The manifest is kept, unreferenced, carrying the reason — so reinstating it is a decision rather than a rediscovery. Co-Authored-By: Claude Opus 5 --- kong/kustomization.yaml | 1 - kong/rest/pluginbindings.yaml | 18 ------------------ kong/rest/proxy-cache.yaml | 18 ++++++++++++++++++ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/kong/kustomization.yaml b/kong/kustomization.yaml index c923648..59304f8 100644 --- a/kong/kustomization.yaml +++ b/kong/kustomization.yaml @@ -7,7 +7,6 @@ resources: - rest/path-rewrite-bindings.yaml - rest/kongplugin.yaml - rest/rate-limiting.yaml - - rest/proxy-cache.yaml - rest/audit-log.yaml - rest/audit-log-body-capture.yaml - rest/audit-log-body-capture-bindings.yaml diff --git a/kong/rest/pluginbindings.yaml b/kong/rest/pluginbindings.yaml index ccd0e18..87c6da2 100644 --- a/kong/rest/pluginbindings.yaml +++ b/kong/rest/pluginbindings.yaml @@ -36,24 +36,6 @@ spec: --- apiVersion: configuration.konghq.com/v1alpha1 kind: KongPluginBinding -metadata: - name: ${NAME}-sales-api-proxy-cache-binding - namespace: ${NAMESPACE} -spec: - controlPlaneRef: - type: konnectNamespacedRef - konnectNamespacedRef: - name: ${CONTROL_PLANE_REF_NAME} - pluginRef: - name: ${NAME}-sales-api-proxy-cache - targets: - serviceRef: - group: configuration.konghq.com - kind: KongService - name: ${NAME}-sales-api ---- -apiVersion: configuration.konghq.com/v1alpha1 -kind: KongPluginBinding metadata: name: ${NAME}-sales-api-audit-log-binding namespace: ${NAMESPACE} diff --git a/kong/rest/proxy-cache.yaml b/kong/rest/proxy-cache.yaml index 933a2fc..1a96541 100644 --- a/kong/rest/proxy-cache.yaml +++ b/kong/rest/proxy-cache.yaml @@ -1,3 +1,21 @@ +# NOT APPLIED — deliberately unreferenced by kustomization.yaml. +# +# This cached every GET on the whole service for 60 seconds, and these are +# read-write APIs. Kong's proxy cache has **no invalidation on write**: a POST +# that changes a product passes through the same gateway, and the gateway goes +# on serving the value it captured before, for up to a minute, with nothing in +# the response saying so. +# +# It produced a real wrong answer. An agent woken by a stock event read the +# figure from before that event and reported, in one sentence, "68 in stock, +# above the threshold" and "it crossed the threshold, from 68". +# +# Kept here rather than deleted so that reinstating it is a decision, not a +# rediscovery. If it comes back, it belongs on reference data that is not +# written through this gateway, bound per route — or with `cache_control: true` +# so the API declares what is cacheable, which is the owner's call and not the +# gateway's. +# apiVersion: configuration.konghq.com/v1 kind: KongPlugin metadata: