Skip to content

Configure Proxy-Cache on a Consumer

You can use the http://localhost:8001/plugins endpoint to enable this plugin on specific Consumers:
http post localhost:8001/consumers/Jason/plugins \
name=proxy-cache \
config:='{"strategy": "memory"}'
Response
The response should look similar to this:
HTTP/1.1 201 Created
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked

{
"config": {
"cache_control": false,
"cache_ttl": 300,
"content_type": [
"application/json"
],
"memory": {
"dictionary_name": "kong_cache"
},
"request_method": [
"GET",
"HEAD"
],
"response_code": [
200,
301,
404
],
"strategy": "memory"
},
"consumer_id": "1264dcd7-1525-4272-90ab-aa17785e7811",
"created_at": 1544596921000,
"enabled": true,
"id": "1303a04a-c0dd-4874-8af5-866bbad28b73",
"name": "proxy-cache"
}
Note: Alternative Configurations
You can also apply the plugin using the custom_id instead of the username.
curl -X POST consumers/{id}/plugins \
--data "name=proxy-cache" \
--data "config.strategy=memory" \
--data "config.content_type=application/json"
Where consumer_id is the id of the Consumer we want to associate with this plugin. You can combine consumer_id and service_id in the same request, to furthermore narrow the scope of the plugin.

Next Section

Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.