Cache problem not work

I have docker
tyk-gateway version v3.1.1.
I have enabled caching using an API definition:
“cache_options”: {
“cache_timeout”: 6000,
“enable_cache”: true,
“cache_all_safe_requests”: false,
“enable_upstream_cache_control”: false,
“cache_by_headers”: [],
“cache_response_codes”: []
},

But the cache is not working, any ideas? Something to configure additional?
Thanks greetings

@juanjo_granada can you please send the whole API definition? I will try to recreate the issue.

@zaid thanks:
{

"name": "Test APIcaqche",

"slug": "test-api-cache",

"api_id": "3",

"org_id": "3",

"use_keyless": true,

"auth": {

  "auth_header_name": ""

},

"cache_options": {

    "cache_timeout": 10,

    "enable_cache": true,

    "cache_all_safe_requests": false,

    "enable_upstream_cache_control": false,

    "cache_by_headers": [],

    "cache_response_codes": [200]

},

"definition": {

  "location": "header",

  "key": "x-api-version"

},

"version_data": {

  "not_versioned": true,

  "versions": {

    "Default": {

      "name": "Default",

      "use_extended_paths": true

    }

  }

},

"proxy": {

  "listen_path": "/test-api-cache-time/",

  "target_url": "http://worldclockapi.com/api/json/est/now",

  "strip_listen_path": true

},

"active": true

}

1 Like

Hello @juanjo_granada if you enable cache_all_safe_requests to true the caching should work. To read more on this please visit the docs page on caching.