proxy_store remote control

Maxim Dounin mdounin at mdounin.ru
Wed Sep 17 19:02:32 MSD 2008


Hello!

Патч, выключающий proxy_store если от бекенда пришёл заголовок 
X-Accel-Expires: 0. Вдруг кому пригодится.

Maxim Dounin
-------------- next part --------------
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1221663539 -14400
# Node ID 8d0ef18e13c085ad86cb6ac910b85f15dccdb372
# Parent  35409f39a096a1575bb24e34c61ee1b4b553aa94
Upstream: switch off proxy_store if upstream said to.

If we got X-Accel-Expires header with value 0 from upstream, don't store
response.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2067,6 +2067,9 @@ ngx_http_upstream_process_body(ngx_event
 
             if (p->upstream_eof
                 && u->headers_in.status_n == NGX_HTTP_OK
+                && (!u->headers_in.x_accel_expires
+                    || u->headers_in.x_accel_expires->value.len != 1
+                    || u->headers_in.x_accel_expires->value.data[0] != '0')
                 && (u->headers_in.content_length_n == -1
                     || (u->headers_in.content_length_n == tf->offset)))
             {


More information about the nginx mailing list