重复更改后,Nginx不会刷新文件.返回旧的上次修改的标头 [英] Nginx does not refresh file after repeated changing. Old Last Modified header is returned
问题描述
我有网络应用程序,并且有可以刷新商店徽标的界面.刷新徽标时,我将使用新的last-modified
标头添加新文件:
I have web-application, and there is interface where I can refresh logo of a shop. When I refresh logo, I gеt new file with new last-modified
header:
Nginx返回更正的更新文件.
Nginx returns corrected updated file.
之后,我再次更新徽标.但是我得到了带有旧last-modified
的旧徽标,尽管徽标url文件已更改(您可以在url的末尾看到查询时间戳):
After that I update logo again. But I get old logo with old last-modified
, although logo url file was changed (you can see query timestamp at the end of url):
如果我通过浏览器执行直接请求,则会得到更新的文件:
If I perform direct request through browser, then I get updated file:
这可以通过content-length在文件大小中看到.
This can be seen in the file size via content-length.
我对图像的Nginx配置是:
My nginx config for images is:
location ~* ^.+\.(jpg|jpeg|svg|gif|png)$ {
expires 10d;
try_files $uri @app;
}
我不明白我在做什么错.请帮我.预先感谢
I don't understand what I'm doing wrong. Please, help me. Thanks in advance
推荐答案
没有足够的信息来确定所遇到问题的根本原因.我还可以想象,所有遇到此问题的新人都会遇到一个与上面概述的问题稍有不同的问题.
There is not enough information to determine the root cause of the problem that's being experienced; I also imagine that all new folks that come to this question experience a slightly different problem that the one outlined above.
Nginx具有 http://nginx.org/r/if_modified_since 指令,您可以请在 ngx_http_not_modified_filter_module.c :: ngx_http_not _)()中查看实现的源代码/a>.
Nginx has http://nginx.org/r/if_modified_since directive, you can take a look at the source code of the implementation in ngx_http_not_modified_filter_module.c :: ngx_http_not_modified_header_filter().
通常,仅因为URL的纪元参数已更改(?
部分,以UNIX时间为结尾),但这并不意味着必须提供新的资源来确定仅因为前两张图片的URL不同,而Last-Modified
时间相同,nginx是错误的,这是不正确的.同样,最后第三张图片列出了304 Not Modified
响应,但没有有关
In general, just because the URL has a changed epoch parameter (the ?
part with the UNIX time as a trailing slug), doesn't at all mean that a new resource has to be provided, so, to determine that nginx is wrong simply because the URL is different between the first two pics, yet Last-Modified
time is same, is not correct. Likewise, the final third pic lists a 304 Not Modified
response, yet there is no information about the If-Modified-Since
nor If-None-Match
headers in the response, and the attribution for the pic doesn't make any sense, either.
这篇关于重复更改后,Nginx不会刷新文件.返回旧的上次修改的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!