-
Notifications
You must be signed in to change notification settings - Fork 454
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
feat: add plugin - cache control #810
Conversation
@LeBW 有几个修改建议: |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #810 +/- ##
==========================================
+ Coverage 38.13% 38.16% +0.02%
==========================================
Files 61 61
Lines 10436 10436
==========================================
+ Hits 3980 3983 +3
+ Misses 6156 6154 -2
+ Partials 300 299 -1 |
@LeBW CI没通过,麻烦更新下 proxy-wasm-go 这个lib的依赖,目录改到 higress-group 下了 |
@LeBW go文件需要添加下copyright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@johnlanni |
@ZJfans Higress没有静态文件代理的能力,只能代理请求到后端,没法知道资源有没有发生变更,所以无法支持etag |
Ⅰ. Describe what this PR did
feat: add plugin - cache control.
Ⅱ. Does this pull request fix one issue?
fixes #621
功能说明
cache-control
插件实现了基于 URL 文件后缀来为请求的响应头部添加Expires
和Cache-Control
头部,从而方便浏览器对特定后缀的文件进行缓存,例如jpg
、png
等图片文件。配置字段
jpg
、png
等。如果需要匹配多种后缀,需要用|
进行分割,例如png|jpg
配置示例
屏蔽请求 url 路径
根据该配置,下列请求在访问时,将会在响应头中添加
Expires
和Cache-Control
字段,且过期时间为 1 小时后。