Mercurial > hg > nginx
comparison src/http/modules/ngx_http_proxy_module.c @ 5441:43ccaf8e8728
Upstream: cache revalidation with conditional requests.
The following new directives are introduced: proxy_cache_revalidate,
fastcgi_cache_revalidate, scgi_cache_revalidate, uwsgi_cache_revalidate.
Default is off. When set to on, they enable cache revalidation using
conditional requests with If-Modified-Since for expired cache items.
As of now, no attempts are made to merge headers given in a 304 response
during cache revalidation with headers previously stored in a cache item.
Headers in a 304 response are only used to calculate new validity time
of a cache item.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 18 Nov 2013 20:48:22 +0400 |
parents | e65be17e3a3e |
children | e7b3b9855be8 |
comparison
equal
deleted
inserted
replaced
5440:cbb9a6c7493c | 5441:43ccaf8e8728 |
---|---|
463 ngx_conf_set_msec_slot, | 463 ngx_conf_set_msec_slot, |
464 NGX_HTTP_LOC_CONF_OFFSET, | 464 NGX_HTTP_LOC_CONF_OFFSET, |
465 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_timeout), | 465 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_lock_timeout), |
466 NULL }, | 466 NULL }, |
467 | 467 |
468 { ngx_string("proxy_cache_revalidate"), | |
469 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
470 ngx_conf_set_flag_slot, | |
471 NGX_HTTP_LOC_CONF_OFFSET, | |
472 offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_revalidate), | |
473 NULL }, | |
474 | |
468 #endif | 475 #endif |
469 | 476 |
470 { ngx_string("proxy_temp_path"), | 477 { ngx_string("proxy_temp_path"), |
471 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, | 478 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, |
472 ngx_conf_set_path_slot, | 479 ngx_conf_set_path_slot, |
620 { ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") }, | 627 { ngx_string("Content-Length"), ngx_string("$proxy_internal_body_length") }, |
621 { ngx_string("Transfer-Encoding"), ngx_string("") }, | 628 { ngx_string("Transfer-Encoding"), ngx_string("") }, |
622 { ngx_string("Keep-Alive"), ngx_string("") }, | 629 { ngx_string("Keep-Alive"), ngx_string("") }, |
623 { ngx_string("Expect"), ngx_string("") }, | 630 { ngx_string("Expect"), ngx_string("") }, |
624 { ngx_string("Upgrade"), ngx_string("") }, | 631 { ngx_string("Upgrade"), ngx_string("") }, |
625 { ngx_string("If-Modified-Since"), ngx_string("") }, | 632 { ngx_string("If-Modified-Since"), |
633 ngx_string("$upstream_cache_last_modified") }, | |
626 { ngx_string("If-Unmodified-Since"), ngx_string("") }, | 634 { ngx_string("If-Unmodified-Since"), ngx_string("") }, |
627 { ngx_string("If-None-Match"), ngx_string("") }, | 635 { ngx_string("If-None-Match"), ngx_string("") }, |
628 { ngx_string("If-Match"), ngx_string("") }, | 636 { ngx_string("If-Match"), ngx_string("") }, |
629 { ngx_string("Range"), ngx_string("") }, | 637 { ngx_string("Range"), ngx_string("") }, |
630 { ngx_string("If-Range"), ngx_string("") }, | 638 { ngx_string("If-Range"), ngx_string("") }, |
2452 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; | 2460 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; |
2453 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; | 2461 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
2454 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; | 2462 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
2455 conf->upstream.cache_lock = NGX_CONF_UNSET; | 2463 conf->upstream.cache_lock = NGX_CONF_UNSET; |
2456 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC; | 2464 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC; |
2465 conf->upstream.cache_revalidate = NGX_CONF_UNSET; | |
2457 #endif | 2466 #endif |
2458 | 2467 |
2459 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; | 2468 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; |
2460 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; | 2469 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; |
2461 | 2470 |
2707 ngx_conf_merge_value(conf->upstream.cache_lock, | 2716 ngx_conf_merge_value(conf->upstream.cache_lock, |
2708 prev->upstream.cache_lock, 0); | 2717 prev->upstream.cache_lock, 0); |
2709 | 2718 |
2710 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, | 2719 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, |
2711 prev->upstream.cache_lock_timeout, 5000); | 2720 prev->upstream.cache_lock_timeout, 5000); |
2721 | |
2722 ngx_conf_merge_value(conf->upstream.cache_revalidate, | |
2723 prev->upstream.cache_revalidate, 0); | |
2712 | 2724 |
2713 #endif | 2725 #endif |
2714 | 2726 |
2715 ngx_conf_merge_str_value(conf->method, prev->method, ""); | 2727 ngx_conf_merge_str_value(conf->method, prev->method, ""); |
2716 | 2728 |