apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.39k stars 2.5k forks source link

Set proxy_ignore_headers to proxy-cache config block #11573

Open josemrs opened 3 weeks ago

josemrs commented 3 weeks ago

Description

We'd like to be able to set the proxy_ignore_headers in the proxy-cache config block

Use case: We want to cache responses no matter what's in the Cache-Control header so we need to set proxy_ignore_headers Cache-Control;

Ideally this should be per route, as we configure the proxy-cache plugin per route. Our deployment relies in K8S APISIXRoute resources for configuration so I assume this will affect some other layers apart from the LUA tpl.

We have tested this in a live system by tweaking the nxg_tpl.lua file and reloading the config. After reloading the config the cache started HIT'ing just fine, whole before it was always MISS'ing

josemrs commented 3 weeks ago

I comment just to add: we found this by looking at Nginx doc here in particular the Can Cache-Control Headers Be Ignored? section

josemrs commented 3 weeks ago

I though this may be doable using http_server_location_configuration_snippet added in this PR but I cannot find the way to set it from the helm chart I think it's missing there.