<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">I'm not sure if this will help, but I ignore/hide a lot, this is in my config</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;<br>
proxy_hide_header X-Accel-Expires;</div>
<div>proxy_hide_header Pragma;<br>
proxy_hide_header Server;<br>
proxy_hide_header Request-Context;<br>
proxy_hide_header X-Powered-By;<br>
proxy_hide_header X-AspNet-Version;<br>
proxy_hide_header X-AspNetMvc-Version;</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I have not experienced the problem you mention, I just thought I would offer my config.<br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div class="BodyFragment"><font size="2"><span style="font-size:10pt">
<div class="PlainText">
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">___________________________________________</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">Michael Friscia</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">Office of Communications</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">Yale School of Medicine</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">(203) 737-7932 – office</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A">(203) 931-5381 – mobile</span></p>
<p class="x_MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt; color:#44546A"><a href="http://web.yale.edu/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><span style="color:#44546A">http://web.yale.edu</span></a></span></p>
</div>
</span></font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> nginx <nginx-bounces@nginx.org> on behalf of Quintin Par <quintinpar@gmail.com><br>
<b>Sent:</b> Saturday, May 12, 2018 1:32 PM<br>
<b>To:</b> nginx@nginx.org<br>
<b>Subject:</b> Re: Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid</font>
<div> </div>
</div>
<meta content="text/html; charset=utf-8">
<div>
<div dir="ltr"><img class="x_mailtrack-img" alt="" style="display:flex" width="0" height="0" src="https://mailtrack.io/trace/mail/f79d75398a26222876e07ab2e9fb1171893daf40.png?u=74734">
<div>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
That’s the tricky part. These MISSes are intermittent. Whenever I run curl I get HITs but I end up seeing a lot of MISS in the logs.
<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span> </span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
How do I log these MiSSes with the reason? I want to know what headers ended up bypassing the cache.<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span> </span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
Here’s my caching config<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span> </span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>  </span><span>          </span>proxy_pass <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__127.0.0.1-3A8000&d=DwMFaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=F-qGMOyS74uE8JM-dOLmNH92bQ1xQ-7Rj1d6k-_WST4&s=NHvlb1WColNwTWBF36P1whJdu5iWHK9_50IDHugaEdQ&e=" id="LPlnk106503" class="OWAAutoLink" previewremoved="true">
http://127.0.0.1:8000</a>;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_set_header X-Real-IP<span>  </span>$remote_addr;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>             </span><span>   </span>proxy_set_header X-Forwarded-Proto https;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_set_header X-Forwarded-Port 443;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span> </span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span># If logged in, don't cache.<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>            </span><span>      </span>set $do_not_cache 1;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>}<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_cache_key "$scheme://$host$request_uri$do_not_cache";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_cache staticfilecache;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>add_header Cache-Control public;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_cache_valid<span>       </span>200 120d;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_hide_header "Set-Cookie";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_ignore_headers<span>  </span>"Set-Cookie";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_ignore_headers<span>  </span>"Cache-Control";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_hide_header "Cache-Control";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_pass_header X-Accel-Expires;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span> </span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_set_header Accept-Encoding "";<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_ignore_headers Expires;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>   </span><span>             </span>add_header X-Cache-Status $upstream_cache_status;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_cache_use_stale<span>   </span>timeout;<span></span></p>
<p class="x_MsoNormal" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:Calibri,sans-serif">
<span>                </span>proxy_cache_bypass $arg_nocache $do_not_cache;<br clear="all">
</p>
<div>
<div dir="ltr" class="x_gmail_signature">
<div class="x_gmail_signature">- Quintin</div>
</div>
</div>
</div>
<br>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr">On Sat, May 12, 2018 at 10:29 AM Lucas Rolff <<a href="mailto:lucas@lucasrolff.com" id="LPlnk26217" class="OWAAutoLink" previewremoved="true">lucas@lucasrolff.com</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div lang="DA">
<div class="x_m_5039261820505189399WordSection1">
<p class="x_MsoNormal"><span lang="EN-GB">It can be as simple as doing a curl to your “origin” url (the one you proxy_pass to) for the files you see that gets a lot of MISS’s – if there’s odd headers such as cookies etc, then you’ll most likely experience a
 bad cache if your nginx is configured to not ignore those headers.<u></u><u></u></span></p>
<p class="x_MsoNormal"><span lang="EN-GB"><u></u> <u></u></span></p>
<div style="border:none; border-top:solid #b5c4df 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal" style="margin-left:36.0pt"><b><span style="font-size:12.0pt; color:black">From:
</span></b><span style="font-size:12.0pt; color:black">nginx <<a href="mailto:nginx-bounces@nginx.org" target="_blank" id="LPlnk804477" class="OWAAutoLink" previewremoved="true">nginx-bounces@nginx.org</a>> on behalf of Quintin Par <<a href="mailto:quintinpar@gmail.com" target="_blank" id="LPlnk19630" class="OWAAutoLink" previewremoved="true">quintinpar@gmail.com</a>><br>
<b>Reply-To: </b>"<a href="mailto:nginx@nginx.org" target="_blank" id="LPlnk651746" class="OWAAutoLink" previewremoved="true">nginx@nginx.org</a>" <<a href="mailto:nginx@nginx.org" target="_blank" id="LPlnk352994" class="OWAAutoLink" previewremoved="true">nginx@nginx.org</a>><br>
<b>Date: </b>Saturday, 12 May 2018 at 18.26<br>
<b>To: </b>"<a href="mailto:nginx@nginx.org" target="_blank" id="LPlnk715093" class="OWAAutoLink" previewremoved="true">nginx@nginx.org</a>" <<a href="mailto:nginx@nginx.org" target="_blank" id="LPlnk340378" class="OWAAutoLink" previewremoved="true">nginx@nginx.org</a>><br>
<b>Subject: </b>Debugging Nginx Cache Misses: Hitting high number of MISS despite high proxy valid<u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><u></u> <u></u></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><a name="x_m_5039261820505189399__MailOriginalBody" id="LPlnk841575" class="OWAAutoLink" previewremoved="true"><img id="x_m_5039261820505189399_x0000_i1025" alt="https://mailtrack.io/trace/mail/86a613eb1ce46a4e7fa6f9eb96989cddae639800.png?u=74734" src="https://mailtrack.io/trace/mail/86a613eb1ce46a4e7fa6f9eb96989cddae639800.png?u=74734"><u></u><u></u></a></p>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">My proxy cache path is set to a very high size</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">proxy_cache_path  /var/lib/nginx/cache  levels=1:2   keys_zone=staticfilecache:180m  max_size=700m;</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">and the size used is only</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">sudo du -sh *</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">14M cache</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">4.0K    proxy</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">Proxy cache valid is set to</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">proxy_cache_valid 200 120d;</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">I track HIT and MISS via</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">add_header X-Cache-Status $upstream_cache_status;</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">Despite these settings I am seeing a lot of MISSes. And this is for pages I intentionally ran a cache warmer an hour ago.</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><u></u> <u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black">How do I debug why these MISSes are happening? How do I find out if the miss was due to eviction, expiration, some rogue header etc? Does Nginx
 provide commands for this?</span></span><span><u></u><u></u></span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span><span style="font-family:"Arial",sans-serif; color:black"><u></u> <u></u></span></span></p>
</div>
</div>
<div>
<div>
<div>
<p class="x_MsoNormal" style="margin-left:36.0pt"><span>- Quintin</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank" id="LPlnk579149" class="OWAAutoLink" previewremoved="true">nginx@nginx.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.nginx.org_mailman_listinfo_nginx&d=DwMFaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=F-qGMOyS74uE8JM-dOLmNH92bQ1xQ-7Rj1d6k-_WST4&s=D3LnZhfobOtlEStCvCDrcwmHydEHaGRFC4gnWvRT5Uk&e=" rel="noreferrer" target="_blank" id="LPlnk537643" class="OWAAutoLink" previewremoved="true">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote>
</div>
</div>
</div>
</div>
</body>
</html>