Azure / api-management-self-hosted-gateway

Home of Azure API Management's Self-Hosted Gateway
https://docs.microsoft.com/en-gb/azure/api-management/self-hosted-gateway-overview
Other
66 stars 27 forks source link

Cache Lookup `vary-by-query-parameter` not working #211

Open oskrabanek opened 1 year ago

oskrabanek commented 1 year ago

Report

Cache Lookup policy should by default cache separately by all query parameters as stated in the documentation at vary-by-query-parameter. Even when specifying the caching with vary-by-query-parameter element the caching still doesn't respect the caching. I would expect the query would be reflected in the cache key, which is not e.g. 3_apimtestwe.azure-api.net.23_static-api_static-api-uat;rev=1.38718_GetTenantApplicationsFooter.37979_8_https_graphql-we-uat.services.ori_443_/tenants/ee/applications/footer

Expected Behavior

Cache would take into account the query parameters.

Actual Behavior

CacheLookup with vary-by-query-parameter should store backend request separately based on the query parameters defined.

Steps to Reproduce the Problem

  1. Define /tenants/{tenant}/applications/footer?lang={lang} endpoint
  2. Define policy with <cache-lookup> with <vary-by-query-parameter>lang</vary-by-query-parameter> element
  3. Call the endpoint with different lang values
  4. The cache should contain multiple entries differing based on the query parameter

Logs from self-hosted gateway

None

Self-hosted Gateway Version

2.2.0

Deployment

Self-Managed (YAML/Helm)

Platform

Microsoft Azure

Kubernetes Version

1.25

Anything else?

The issue is reproducible on Managed API Management as well.

tomkerkhove commented 1 year ago

Created an internal bug, thanks for reporting