Hi, Vadim We assume that your test has been passed whether applying Maxim's patch or not the conventional one. (my verification may be inadequate...) : server { : listen 127.0.0.1:8080; : location / { : proxy_pass http://127.0.0.2:8080; : proxy_cache cache_zone; : } : } : server { : listen 127.0.0.2:8080; When I changed thby yugo-horie - Nginx Development
Hello, I appriciate deeply with two of your cooperation. Maxim's patch looks good to see but it seems to be a bit weird about the behavior of the r->cache->valid_sec. In case of the `X-Accel-Expires: 0` header comes first than the `Cache-Control: max-age=10` header, the r->cache->valid_sec could not be overwritten by the process_accel_expires which has a weird switch (if it is case 0,by yugo-horie - Nginx Development
Hi, Vadim We're pleased to have you share your patch! src/http/ngx_http_upstream.c ``` 4803 if (n == 0) { 4804 u->cacheable = 0; 4805 return NGX_OK; 4806 } ``` We consider that X-Accel-Expires seems not to prioritize Cache-Control:max-age=0, when it parses after Cache-Control:max-age=0. Because u->cacheable has been 0 according to this codby yugo-horie - Nginx Development
Hi, Vadim. Thanks for your cooperation! > @@ -5067,6 +5091,7 @@ > || (h->value.len == 1 && h->value.data[0] == '*')) > { > u->cacheable = 0; > + u->cacheable_reason |= NGX_HTTP_CACHEABLE_VARY; > } > I don't see any reasons to store information about "Vary" header. It should not cache only the Vary asterisk. itby yugo-horie - Nginx Development
We're also interested in this issue because the CDN provider like us is concerned about the problems with the headers that determine the cache freshness. It is often a serious problem used in Nginx as the origin server or the intermediate cache server that has such problems. In those days, we also proposed a patch to resolve it. https://mailman.nginx.org/archives/list/nginx-devel@nginx.org/thread/by yugo-horie - Nginx Development
Thanks for reviewing. We've reconsidered that. After all, a new patch has been pushed below this. > the following set of headers will result in caching being incorrectly enabled (while it should be disabled due to Set-Cookie header): Sorry, we had lost these points. So we reconsidered that it had complex rules which include not only Set-Cookie but also Vary asterisk. > A better solutionby yugo-horie - Nginx Development
changeset: 7997:86f70e48a64a branch: issue-964 tag: tip user: Yugo Horie <yugo-horie@jocdn.co.jp> date: Tue Jan 25 12:16:05 2022 +0900 files: src/http/ngx_http_upstream.c src/http/ngx_http_upstream.h description: Prioritize `X-Accel-Expires` than `Cache-Control` and `Expires` (#964) We introduce 3 flags that indicate to be overwriting cache control behavioby yugo-horie - Nginx Development
Excuse me for refer to quite old issue, we found a different behavior regarding their headers order in case of X-Accel-Expires which is not 0 and Cache-Control has any of no-store, no-cache or private. It is very easy reproducing process. ngx_http_upstream.c has two method ngx_http_upstream_process_cache_control and ngx_http_upstream_process_accel_expires which operations their cache relatedby yugo-horie - Nginx Mailing List - English