apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: proxy-cache plugin has side-effect even if it's not configured in any route

Open JanLi-air opened this issue 5 years ago • 6 comments

Issue description

If proxy-cache is configured in plugin list, it will override Cache-Control and Expires headers from the upstream. Problem is that even if proxy-cache is not configured in any route, those headers will still be overridden. So we have a side effect for proxy-cache.

Environment

  • apisix version (cmd: apisix version): 2.0
  • OS (cmd: uname -a): linux
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V): openresty/1.19.3.1
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have:

Minimal test code / Steps to reproduce the issue

  1. Use the default configuration from apisix
  2. Write Cache-Control and Expires headers in upstream
  3. Check the response

What's the actual result? (including assertion message & call stack if applicable)

Cache-Control and Expires headers disappeared

What's the expected result?

If proxy-cache is not configured for a route, apisix should not rewrite Cache-Control and Expires headers.

JanLi-air avatar Feb 25 '21 13:02 JanLi-air

it is not easy to fix this bug, I think it needs to change the Nginx core.

membphis avatar Feb 25 '21 13:02 membphis

disable proxy-cache plugin is a simple way for most users

membphis avatar Feb 25 '21 13:02 membphis

Agree, but proxy-cache might be used in some scenarios. The fix might not be available to all users.

JanLi-air avatar Feb 25 '21 13:02 JanLi-air

Similar like https://github.com/apache/apisix/issues/3373?

spacewander avatar Feb 26 '21 01:02 spacewander

Similar like #3373?

Yes, seems the same

JanLi-air avatar Feb 26 '21 05:02 JanLi-air

Will you submit a fix? I have already provided a solution in that issue.

spacewander avatar Feb 26 '21 07:02 spacewander