【发布时间】:2020-10-09 21:33:38
【问题描述】:
假设我的应用程序在文件所在的位置
https://myapp.com/v1/assets/images/*.jpg
和
https://myapp.com/v1/assets/js/*.jpg
我想添加一条规则,将 no-cache 标头设置为 /assets 下的任何内容
我相信我现在能做的就是
location ~ .*assets/js/.*$ {
add_header Cache-Control "public, max-age=0, no-store";
}
location ~ .*assets/images/.*$ {
add_header Cache-Control "public, max-age=0, no-store";
}
但这似乎不起作用,如果我在资产下有许多其他文件夹,我将需要添加一个单独的规则。
我可以将所有内容分组到一个模式中,以便 /assets/* 下的任何内容都有该标题吗?
谢谢
【问题讨论】:
标签: nginx browser-cache nginx-reverse-proxy nginx-config