Index: http/ngx_http_upstream.c
===================================================================
--- http/ngx_http_upstream.c	(revision 4146)
+++ http/ngx_http_upstream.c	(working copy)
@@ -683,6 +683,8 @@
             return NGX_DECLINED;
         }
 
+        u->cacheable = 1;
+
         switch (ngx_http_test_predicates(r, u->conf->cache_bypass)) {
 
         case NGX_ERROR:
@@ -696,8 +698,6 @@
             break;
         }
 
-        u->cacheable = 1;
-
         c = r->cache;
 
         c->min_uses = u->conf->cache_min_uses;
@@ -2182,7 +2182,6 @@
                 return;
             }
 
-            u->cacheable = 1;
         }
 
         break;
