0

I am trying to configure caching in KONGA for certain URL with query params.

What I would like to achieve is :

This should be cached -> GET /my-awesome-service/get-something?filter-one=this&filter-two=that

This should be cached differently -> GET /my-awesome-service/get-something?filter-one=this&filter-two=their

What I am facing is GET /my-awesome-service/get-something is being cached and hence returning incorrect data for different filters.

enter image description here

Raja
  • 851
  • 9
  • 22

1 Answers1

0

As explain into the documentation you need to set the query param to use on the cache key via config.vary_query_params or keep it undefined to use all query params. You already set it to timeframe so you need to add filter-one and filter-two

Yaml should be something like that:

        plugins:
          - name: proxy-cache
            config:
              cache_control: false
              content_type:
                - application/json
              memory:
                dictionary_name: kong_db_cache
              request_method:
                - GET
              response_code:
                - 200
              strategy: memory
              vary_query_params:
                - timeframe
                - filter-one
                - filter-two
            enabled: true
            protocols:
              - grpc
              - grpcs
              - http
              - https
Ôrel
  • 7,044
  • 3
  • 27
  • 46