Kong: proxy-cache stores responses at the gateway

Cacheable responses are served from Kong without touching the upstream. The cache key defaults to method plus URI, and only the status codes and content types you list are stored.

Code
curl -X POST http://localhost:8001/routes/api/plugins \
  --data name=proxy-cache \
  --data 'config.response_code[]=200' \
  --data 'config.request_method[]=GET' \
  --data 'config.content_type[]=application/json' \
  --data config.cache_ttl=60 \
  --data config.strategy=memory
Output
First request:   X-Cache-Status: Miss
Second request:  X-Cache-Status: Hit    (0.4 ms, upstream untouched)
After 60s:       X-Cache-Status: Refresh

# X-Cache-Status values: Miss, Hit, Refresh, Bypass
#
# The default key ignores the Authorization header, so a cached response for
# one user can be served to another. Add vary_headers, or do not cache
# per-user responses at all.
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25