<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Maxim,<div><br></div><div>Ok, thanks for the clarification.</div><div><br></div><div>So to confirm, we are looking for the value of the sent header from the upstream, to identify whether the content should be served from the cache, or the upstream. Does this therefore mean that the code that we have below, will check for the X-No-Cache header, and if present, will always render the content from the upstream (no cache), and that if not present, will enable the result to be cacheable? If so, and it is only the reporting of the X-Cache-Status value that is rendering a false value, then this will give us what we want?</div><div><br></div><div>If not, then what suggestions would you have for caching only on the basis of this sent http header being present?</div><div><br></div><div>Thanks again…nearly there ;)</div><div><br></div><div>Paul</div><div><br><div><div>On 16 Dec 2013, at 11:12, Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hello!<br><br>On Mon, Dec 16, 2013 at 09:22:25AM +0000, Paul Taylor wrote:<br><br><blockquote type="cite">Yup, again, you’re right! I’ve moved the config around, so that I’m testing for any ‘true’ value in the proxy_no_cache & proxy_bypass_cache directives (removing the existing set_by_lua block).<br><br>However, it’s still not behaving as I’d expect.<br><br>In the following scenario (note comments):<br><br>map $upstream_http_x_no_cache $no_cache_header {<br> "" 0;<br> default 1;<br>}<br><br>proxy_cache_bypass $no_cache_dirs $logged_in; # $no_cache_header;<br>proxy_no_cache<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-converted-space"> </span> $no_cache_dirs $logged_in; # $no_cache_header;<br><br>X-Cache-Status value is MISS, which is correct. Output of $no_cache_header is 1 (as set in the map).<br><br>However, when adding back in the compare on $no_cache_header:<br><br>proxy_cache_bypass $no_cache_dirs $logged_in $no_cache_header;<br>proxy_no_cache<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-converted-space"> </span> $no_cache_dirs $logged_in $no_cache_header;<br><br>X-Cache-Status value is still MISS, which is not correct, as it should be BYPASS. Output of $no_cache_header is 0.<br><br>Unless I’m missing something, it still looks like touching the variable kills it?<br></blockquote><br>The proxy_cache_bypass directive is expected to be checked before<span class="Apple-converted-space"> </span><br>a request is sent to a backend - it is to control whether a<span class="Apple-converted-space"> </span><br>request will be served from a cache or passed to a backend.<br><br>That is, what you see is actually expected behaviour - there are<span class="Apple-converted-space"> </span><br>no reasons X-Cache-Status to be BYPASS, and the cached<span class="Apple-converted-space"> </span><br>$no_cache_header value to be different from 0.<br><br>--<span class="Apple-converted-space"> </span><br>Maxim Dounin<br><a href="http://nginx.org/">http://nginx.org/</a><br><br>_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br><a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></div></blockquote></div><br></div></body></html>