<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Hello,<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 21, 2013 at 10:35 PM, cachito <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">B.R. Wrote:<br>
-------------------------------------------------------<br>
<div class="im">> Hello,<br>
><br>
> On Wed, Aug 21, 2013 at 9:42 PM, cachito <<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>> wrote:<br>
><br>
> > if ($http_cookie ~*<br>
> ><br>
> "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in")<br>
> {<br>
> > set $no_cache 1;<br>
> > }<br>
> ><br>
><br>
> If the user sends requests using cookies from Wordpress, the cache<br>
> won't<br>
> be used...<br>
> Thus, you seem not to cache requests from Wordpress at all. That CMS<br>
> need<br>
> resources such as power and generates huge traffic (that needs to be<br>
> processed aswell).<br>
> Are you sure not all the Wordpress requests contain cookie(s)?<br>
> <br>
<br>
</div>I'm manually deleting cookies to force caching and it isn't happening. Even<br>
if I set $no_cache to 0 in this particular section (or at the end of the if<br>
list) nothing happens.<br></blockquote><div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">Is your conf really applied? Check logs on reload to be sure.<br></div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im"><br>
><br>
><br>
> > #The different cache zones reside in different filesystems. the<br>
> "pages"<br>
> > zone<br>
> > is saved in RAM for fast delivery.<br>
> > location / {<br>
> > proxy_pass <a href="http://upstream" target="_blank">http://upstream</a>;<br>
> > proxy_cache pages;<br>
> > proxy_cache_key $cache_key;<br>
> > proxy_cache_valid 60m; # I was hoping to have the proxy query<br>
> the<br>
> > upstream once every hour for updated content.<br>
> ><br>
><br>
> Read the correct syntax and use of proxy_cache_valid.<br>
> If no HTTP code is specified as optional parameter, it says 'then only<br>
> 200,<br>
> 301 and 302 responses are cached'.<br>
<br>
</div>This is the intended behavior. If the upstream responds something useful,<br>
cache it and serve it. Errors shouldn't be cached, and the stale cache<br>
should be served for that URL.<br></blockquote><div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline"><br>Ok</div> <br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im"><br>
> <br>
><br>
><br>
> > # 2 rules to dedicate the no caching rule for logged in users.<br>
> > proxy_cache_bypass $no_cache; # Do not cache the response.<br>
> > proxy_no_cache $no_cache; # Do not serve response from cache.<br>
> ><br>
><br>
> Actually, those 2 comments are inverted: proxy_no_cache controls<br>
> whether<br>
> or not items should be written in cache and proxy_cache_bypass<br>
> controls<br>
> whether or not content should be read from it.<br>
<br>
</div>Comments aside, when $no_cache is set to 0 it mandates that the upstream<br>
response should be cached and the client should be served content from<br>
cache, right?<br></blockquote><br><div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">I unnderstood the double negation the same way as yours.<br>---<br></div></div></div><font size="1"><span style="color:rgb(102,102,102)"></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font>
</div></div>