<div dir="ltr"><div>Hi Guillaume,</div><div><br></div><div>Thanks for the response.</div><div><br></div><div><span style="background-color:rgb(255,255,0)">Can you provide us with a log of the transaction please? </span><br></div><div><br></div><div>I have sent a R<b>equest </b>to VARNISH which Contains <b>Cache-Control: no-cache header</b>, we have made sure the request with <b>cache-control header</b> is a MISS with a check in <b>vcl_recv subroutine</b>, so it's a <b>MISS </b>as expected.</div><div><b><br></b></div><div><b><font color="#ff0000">The problem as mentioned before: </font></b></div><div><b><span style="background-color:rgb(244,204,204)">Cache-Control: no-cache</span> header is not being passed to the Backend even though its a MISS.</b></div><div><b><br></b></div><div><b><br></b></div><div><b>Please find below the transaction log of Varnish.</b><br></div><div><br></div><div>* << Request >> 2293779<br>- Begin req 2293778 rxreq<br>- Timestamp Start: 1686730406.463326 0.000000 0.000000<br>- Timestamp Req: 1686730406.463326 0.000000 0.000000<br>- ReqStart IPAddress 61101<br>- ReqMethod GET<br>- ReqURL someURL<br>- ReqProtocol HTTP/1.1<br>- ReqHeader Host: IP:Port<br>- ReqHeader Connection: keep-alive<br>- ReqHeader Pragma: no-cache<br>-<b> </b><span style="background-color:rgb(244,204,204)"><b>ReqHeader Cache-Control: no-cache</b><br></span>- ReqHeader Upgrade-Insecure-Requests: 1<br>- ReqHeader User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/<a href="http://114.0.0.0">114.0.0.0</a> Safari/537.36<br>- ReqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7<br>- ReqHeader Accept-Encoding: gzip, deflate<br>- ReqHeader Accept-Language: en-US,en;q=0.9<br>- ReqHeader X-Forwarded-For: IPAddress<br>- VCL_call RECV<br>- VCL_Log URL:someURL<br>- ReqURL
someURL<br>- ReqHeader X-contentencode: gzip, deflate<br>- VCL_Log HTTP_X_Compression:gzip, deflate<br>- VCL_return hash<br>- ReqUnset Accept-Encoding: gzip, deflate<br>- ReqHeader Accept-Encoding: gzip<br>- VCL_call HASH<br>- ReqHeader hash-url:
someURL<br>- ReqUnset hash-url:
someURL<br>- ReqHeader hash-url:
someURL<br>- VCL_Log hash-url:
someURL<br>- ReqUnset hash-url:
someURL<br>- VCL_return lookup<br>- VCL_call MISS<br>- VCL_return fetch<br><span style="background-color:rgb(244,204,204)"><b>- Link bereq 2293780 fetch</b></span><br>- Timestamp Fetch: 1686730406.515526 0.052200 0.052200<br>- RespProtocol HTTP/1.1<br>- RespStatus 200<br>- RespReason OK<br>- RespHeader add_in_varnish_logs: ResultCount:66|McatCount:10|traceId:96z3uIgBXHUiXRNoegNA<br>- RespHeader Content-Type: text/html;charset=UTF-8<br>- RespHeader Content-Encoding: gzip<br>- RespHeader Vary: Accept-Encoding<br>- RespHeader Date: Wed, 14 Jun 2023 08:13:25 GMT<br>- RespHeader Server: Intermesh Caching Servers/2.0.1<br>- RespHeader X-Varnish: 2293779<br>- RespHeader Age: 0<br>- RespHeader Via: 1.1 varnish (Varnish/5.2)<br>- VCL_call DELIVER<br>- RespHeader X-Edge: MISS<br>- VCL_Log addvg:ResultCount:66|McatCount:10|traceId:96z3uIgBXHUiXRNoegNA<br>- RespUnset add_in_varnish_logs: ResultCount:66|McatCount:10|traceId:96z3uIgBXHUiXRNoegNA<br>- VCL_return deliver<br>- Timestamp Process: 1686730406.515554 0.052228 0.000029<br>- RespHeader Accept-Ranges: bytes<br>- RespHeader Transfer-Encoding: chunked<br>- RespHeader Connection: keep-alive<br>- Timestamp Resp: 1686730406.518064 0.054738 0.002510<br>- ReqAcct 569 0 569 331 36932 37263<br>- End<br><b>** << BeReq >> 2293780</b><br>-- Begin bereq 2293779 fetch<br>-- Timestamp Start: 1686730406.463456 0.000000 0.000000<br>-- BereqMethod GET<br>-- BereqURL
someURL<br>-- BereqProtocol HTTP/1.1<br>-- BereqHeader Host: IP:Port<br>-- BereqHeader Pragma: no-cache<br>-- BereqHeader Upgrade-Insecure-Requests: 1<br>-- BereqHeader User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/<a href="http://114.0.0.0">114.0.0.0</a> Safari/537.36<br>-- BereqHeader Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7<br>-- BereqHeader Accept-Language: en-US,en;q=0.9<br>-- BereqHeader X-Forwarded-For: IPAddress<br>-- BereqHeader X-contentencode: gzip, deflate<br>-- BereqHeader Accept-Encoding: gzip<br>-- BereqHeader X-Varnish: 2293780<br>-- VCL_call BACKEND_FETCH<br>-- BereqUnset Accept-Encoding: gzip<br>-- BereqHeader Accept-Encoding: gzip, deflate<br>-- BereqUnset X-contentencode: gzip, deflate<br>-- VCL_return fetch<br>-- BackendOpen 27 reload_2023-06-07T091359.node66 127.0.0.1 8984 127.0.0.1 39154<br>-- BackendStart 127.0.0.1 8984<br>-- Timestamp Bereq: 1686730406.463621 0.000165 0.000165<br>-- Timestamp Beresp: 1686730406.515400 0.051944 0.051779<br>-- BerespProtocol HTTP/1.1<br>-- BerespStatus 200<br>-- BerespReason OK<br>-- BerespHeader Server: Apache-Coyote/1.1<br>-- BerespHeader add_in_varnish_logs: ResultCount:66|McatCount:10|traceId:96z3uIgBXHUiXRNoegNA<br>-- BerespHeader Content-Type: text/html;charset=UTF-8<br>-- BerespHeader Transfer-Encoding: chunked<br>-- BerespHeader Content-Encoding: gzip<br>-- BerespHeader Vary: Accept-Encoding<br>-- BerespHeader Date: Wed, 14 Jun 2023 08:13:25 GMT<br>-- TTL RFC 120 10 0 1686730407 1686730407 1686730405 0 0<br>-- VCL_call BACKEND_RESPONSE<br>-- BerespUnset Server: Apache-Coyote/1.1<br>-- BerespHeader Server: Caching Servers/2.0.1<br>-- TTL VCL 120 604800 0 1686730407<br>-- TTL VCL 86400 604800 0 1686730407<br>-- VCL_return deliver<br>-- Storage malloc s0<br>-- ObjProtocol HTTP/1.1<br>-- ObjStatus 200<br>-- ObjReason OK<br>-- ObjHeader add_in_varnish_logs: ResultCount:66|McatCount:10|traceId:96z3uIgBXHUiXRNoegNA<br>-- ObjHeader Content-Type: text/html;charset=UTF-8<br>-- ObjHeader Content-Encoding: gzip<br>-- ObjHeader Vary: Accept-Encoding<br>-- ObjHeader Date: Wed, 14 Jun 2023 08:13:25 GMT<br>-- ObjHeader Server: Caching Servers/2.0.1<br>-- Fetch_Body 2 chunked stream<br>-- Gzip u F - 36932 291926 80 211394 295386<br>-- BackendReuse 27 reload_2023-06-07T091359.node66<br>-- Timestamp BerespBody: 1686730406.518050 0.054594 0.002650<br>-- Length 36932<br>-- BereqAcct 574 0 574 276 36932 37208<br>-- End<br></div><div><br></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><font color="#000000">Thanks & Regards</font><div><font color="#000000">Uday Kumar</font></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 13, 2023 at 2:13 AM Guillaume Quintard <<a href="mailto:guillaume.quintard@gmail.com" target="_blank">guillaume.quintard@gmail.com</a>> wrote:<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 dir="ltr">Hi Uday,<div><br></div><div>Can you provide us with a log of the transaction please? You can run this on the Varnish server:</div><div><br></div><div> varnishlog -g request -q 'ReqHeader:Cache-Control'</div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><div>And you should see something as soon as you send a request with that header to Varnish. Note that we need the backend part of the transaction, so please don't truncate the block.</div><div><br></div><div>Kind regards,</div><div><br></div><div>-- <br></div><div>Guillaume Quintard<br></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 12, 2023 at 10:33 PM Uday Kumar <<a href="mailto:uday.polu@indiamart.com" target="_blank">uday.polu@indiamart.com</a>> wrote:<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 dir="ltr"><div>Hello,<br><br>When a user refreshes(F5) or performs a hard refresh(ctrl+F5) in their browser, the browser includes the <b>Cache-Control: no-cache</b> header in the request. <br>However, in our<b> production Varnish setup</b>, we have implemented a check that treats<b> requests with Cache-Control: no-cache as cache misses</b>, meaning it bypasses the cache and goes directly to the backend server (Tomcat) to fetch the content.<br><br><b>Example:</b><br>in vcl_recv subroutine of default.vcl:</div><div><br></div><div>sub vcl_recv{</div><div> #other Code</div><div> # Serve fresh data from backend while F5 and CTRL+F5 from user<br> if (req.http.Cache-Control ~ "(no-cache|max-age=0)") {<br> set req.hash_always_miss = true;<br> }</div><div> #other Code</div><div>}</div><div><br><br>However, we've noticed that the <b><font color="#ff0000">Cache-Control: no-cache header is not being passed</font></b> to Tomcat even when there is a cache miss. <br>We're unsure why this is happening and would appreciate your assistance in understanding the cause.<br><br><b>Expected Functionality:</b><br>If the request contains <b>Cache-Control: no-cache header then it should be passed to Tomcat</b> at Backend.<br><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><font color="#000000">Thanks & Regards</font><div><font color="#000000">Uday Kumar</font></div></div></div></div></div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>
</blockquote></div>