Welcome! Log In Create A New Profile

Advanced

[PATCH] During background update, nginx can't add "Range" header

Sangdeuk Kwon
July 23, 2020 01:30AM
# HG changeset patch

# User Sangdeuk Kwon <sangdeuk.kwon@quantil.com>

# Date 1595481798 -32400

# Thu Jul 23 14:23:18 2020 +0900

# Node ID 90e5ccf7c229322079ba1b61b4241ed69dfc09b2

# Parent 4f30f75dbdf33d6fae9e70086e0df5cbab7db027

During background update, nginx can't add "Range" header



If the configuration is "slice enabled" and "proxy_cache_use_stale
updating"
and "proxy_cache_background_update on",

nginx can't get "$slice_range" value during background update.

nginx sends request to upstream without "Range" header.

The re-fetched content is saved by cache key of absent "$slice_range".

So, nginx always serves stale content even though after re-fetching new
content.


slice 1k;

proxy_cache_use_stale updating;

proxy_cache_background_update on;

proxy_cache_key "$host$uri[$slice_range]



diff -r 4f30f75dbdf3 -r 90e5ccf7c229
src/http/modules/ngx_http_slice_filter_module.c
--- a/src/http/modules/ngx_http_slice_filter_module.c Tue Jul 21 20:34:29
2020 +0300
+++ b/src/http/modules/ngx_http_slice_filter_module.c Thu Jul 23 14:23:18
2020 +0900
@@ -400,9 +400,12 @@

ngx_http_slice_loc_conf_t *slcf;



ctx = ngx_http_get_module_ctx(r, ngx_http_slice_filter_module);

+ if (r->background && r != r->main && r->main != r->parent) {

+ ctx = ngx_http_get_module_ctx(r->parent,
ngx_http_slice_filter_module);
+ }



if (ctx == NULL) {

- if (r != r->main || r->headers_out.status) {

+ if ((r != r->main && !r->background) || r->headers_out.status) {

v->not_found = 1;

return NGX_OK;

}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] During background update, nginx can't add "Range" header

Sangdeuk Kwon 89 July 23, 2020 01:30AM

Re: [PATCH] During background update, nginx can't add "Range" header

Roman Arutyunyan 35 July 24, 2020 08:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready