Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JanLi-air opened this issue Feb 25, 2021 · 6 comments · Fixed by #3789
Closed

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

JanLi-air opened this issue Feb 25, 2021 · 6 comments · Fixed by #3789
Labels
bug Something isn't working

Comments

@JanLi-air
Copy link

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.

@membphis membphis added the bug Something isn't working label Feb 25, 2021
@membphis
Copy link
Member

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

@membphis
Copy link
Member

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

@JanLi-air
Copy link
Author

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

@spacewander
Copy link
Member

Similar like #3373?

@JanLi-air
Copy link
Author

Similar like #3373?

Yes, seems the same

@spacewander
Copy link
Member

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

spacewander added a commit to spacewander/incubator-apisix that referenced this issue Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants