Caching Nginx:禁用缓存特定文件名

Caching Nginx:禁用缓存特定文件名,caching,nginx,service-worker,vesta,Caching,Nginx,Service Worker,Vesta,我的服务器使用VestaCP运行多个网站。每个网站都有不同的公共html文件夹和特定的nginx.conf文件。(包括通配符nginx) 我正试图在特定的文件名上禁用nginx中的缓存 我知道如何禁用特定文件的缓存,但每当文件名为“hello.js”(无论从哪个站点/位置传递)时,我都希望禁用nginx.conf中的缓存 示例: https://example.com/hi.js = cached https://example.com/hello.js = not cached htt

我的服务器使用VestaCP运行多个网站。每个网站都有不同的公共html文件夹和特定的nginx.conf文件。(包括通配符nginx)
我正试图在特定的文件名上禁用nginx中的缓存

我知道如何禁用特定文件的缓存,但每当文件名为“hello.js”(无论从哪个站点/位置传递)时,我都希望禁用nginx.conf中的缓存

示例

https://example.com/hi.js = cached  
https://example.com/hello.js = not cached  
https://example.com/test/hello.js = not cached  
https://example.org/index.js = cached  
https://example.org/me/hello.js = not cached  
我知道如何在特定于域的snginx.conf中禁用1个特定文件上的缓存,但我有一条规则,可以为每个名为“hello.js”的文件禁用缓存

如何禁用所有“hello.js”文件(也在服务器上托管的其他域上)的缓存


(我问这个问题是因为我与服务工作者一起工作,服务工作者javascript文件不应该被缓存。如果浏览器缓存了服务工作者文件,那么当缓存名称更改时,新版本永远不会加载。)

实际上,我认为缓存策略应该是“缓存控制:无缓存”这样,它就不必在没有任何更改的情况下重新蚀刻。对吗?
server {
    listen 443 http2;
    server_name example.com;
    location /hello.js{
        add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
        expires -1;
    }
}