Varnish not serving cache

Cloud Image AWS bitnami stack

Varnish configuration should serve file and i should see the serving process under “sudo varnishlog”
But if it run varnishlog i cant see if someone click on some link on my website or i can’t see if someone digit the domain. I can only see log on varnish only if someone write the ip address on url

Varnish request if i write the ip address:

 << Request  >> 32843     
-   Begin          req 32842 rxreq
-   Timestamp      Start: 1617793813.000480 0.000000 0.000000
-   Timestamp      Req: 1617793813.000480 0.000000 0.000000
-   ReqStart       MY_LEGITIMATE_PUBLIC_IP 58546 a0
-   ReqMethod      GET
-   ReqURL         /
-   ReqProtocol    HTTP/1.1
-   ReqHeader      Host: 18.185.149.145
-   ReqHeader      User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0
-   ReqHeader      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
-   ReqHeader      Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3
-   ReqHeader      Accept-Encoding: gzip, deflate
-   ReqHeader      Connection: keep-alive
-   ReqHeader      Upgrade-Insecure-Requests: 1
-   ReqHeader      DNT: 1
-   ReqHeader      Sec-GPC: 1
-   ReqHeader      X-Forwarded-For: 213.136.170.81
-   VCL_call       RECV
-   ReqHeader      grace: none
-   ReqURL         /
-   ReqUnset       Accept-Encoding: gzip, deflate
-   ReqHeader      Accept-Encoding: gzip
-   VCL_return     hash
-   VCL_call       HASH
-   VCL_return     lookup
-   VCL_call       MISS
-   VCL_return     fetch
-   Link           bereq 32844 fetch
-   Timestamp      Fetch: 1617793813.096020 0.095541 0.095541
-   RespProtocol   HTTP/1.1
-   RespStatus     302
-   RespReason     Found
-   RespHeader     Date: Wed, 07 Apr 2021 11:10:13 GMT
-   RespHeader     Server: Apache
-   RespHeader     X-Powered-By: PHP/7.3.25
-   RespHeader     Pragma: no-cache
-   RespHeader     Cache-Control: max-age=0, must-revalidate, no-cache, no-store
-   RespHeader     Expires: Tue, 07 Apr 2020 11:10:13 GMT
-   RespHeader     X-Magento-Debug: 1
-   RespHeader     Content-Security-Policy-Report-Only: font-src *.tawk.to reflexmaniait.b-cdn.net *.fontawesome.com maxcdn.bootstrapcdn.com https://fonts.gstatic.com 'self' 'unsafe-inline'; form-action secure.authorize.net test.authorize.net geostag.cardinalcommerce.com g
-   RespHeader     Content-Security-Policy: upgrade-insecure-requests;
-   RespHeader     X-Content-Type-Options: nosniff
-   RespHeader     X-XSS-Protection: 1; mode=block
-   RespHeader     X-Frame-Options: SAMEORIGIN
-   RespHeader     Set-Cookie: PHPSESSID=dl3vuqnvsqg8br610hf18oirp3; expires=Wed, 07-Apr-2021 12:10:13 GMT; Max-Age=3600; path=/; domain=MY_LEGITIMATE_DOMAIN .it; HttpOnly
-   RespHeader     Location: https://MY_LEGITIMATE_DOMAIN /
-   RespHeader     X-UA-Compatible: IE=edge
-   RespHeader     Content-Length: 0
-   RespHeader     Content-Type: text/html; charset=UTF-8
-   RespHeader     X-Magento-Cache-Control: max-age=0, must-revalidate, no-cache, no-store
-   RespHeader     X-Varnish: 32843
-   RespHeader     Age: 0
-   RespHeader     Via: 1.1 varnish (Varnish/6.0)
-   VCL_call       DELIVER
-   RespHeader     X-Magento-Cache-Debug: MISS
-   RespUnset      Pragma: no-cache
-   RespHeader     Pragma: no-cache
-   RespUnset      Expires: Tue, 07 Apr 2020 11:10:13 GMT
-   RespHeader     Expires: -1
-   RespUnset      Cache-Control: max-age=0, must-revalidate, no-cache, no-store
-   RespHeader     Cache-Control: no-store, no-cache, must-revalidate, max-age=0
-   RespUnset      X-Magento-Debug: 1
-   RespUnset      X-Powered-By: PHP/7.3.25
-   RespUnset      Server: Apache
-   RespUnset      X-Varnish: 32843
-   RespUnset      Via: 1.1 varnish (Varnish/6.0)
-   VCL_return     deliver
-   Timestamp      Process: 1617793813.096072 0.095592 0.000052
-   RespHeader     Connection: keep-alive
-   Timestamp      Resp: 1617793813.096112 0.095632 0.000040
-   ReqAcct        374 0 374 3777 0 3777
-   End            

If i write the domain i don’t have any request under varnishlog.

Another problem always with varnish cache that i don’t understand if it’s linked to the main one.

I have got lot of this request:

*   << Session  >> 65700     
-   Begin          sess 0 HTTP/1
-   SessOpen       172.69.44.76 56873 a0 172.31.23.57 80 1617793989.725069 25
-   SessClose      REM_CLOSE 0.000
-   End            

But i dont understand if they’re legitimate or note.
What this kind of request mean?

Anyone than can Help us?

Hi @reflexmania,

I just launched a fresh Bitnami Magento solution and everything works as expected. This is the output of the sudo varnishstat command

Uptime mgt:      0+00:18:50                                                                                                                                                                                                                Hitrate n:       10       20       20
Uptime child:    0+00:18:51                                                                                                                                                                                                                   avg(n):   0.2048   0.2938   0.2938
Press <h> to toggle help screen
^^^ NAME                                                                                                                                                                                          CURRENT        CHANGE       AVERAGE        AVG_10       AVG_100      AVG_1000
MAIN.uptime                                                                                                                                                                                    0+00:18:51
MAIN.sess_conn                                                                                                                                                                                         31          0.00          0.03          0.23          0.32          0.32
MAIN.client_req                                                                                                                                                                                       397          0.00          0.35          1.83          2.47          2.47
MAIN.cache_hit                                                                                                                                                                                        175          0.00          0.15          1.47          2.00          2.00
MAIN.cache_hit_grace                                                                                                                                                                                    3          0.00          0.00          0.00          0.00          0.00
MAIN.cache_hitmiss                                                                                                                                                                                     24          0.00          0.02          0.16          0.21          0.21
MAIN.cache_miss                                                                                                                                                                                       215          0.00          0.19          0.16          0.21          0.21

Varnish is configured to use the port 80 and receive all the requests and redirect the cache misses to Apache to get the information. We have a Support Tool that will gather relevant information for us to analyze your configuration and logs. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

Please note that you need to paste the code ID that is shown at the end.

The problem is that varnish setted this way will work only on http protocol request and not for https request. So if we set a certificate varnish cant listen on port 443 and you should use a proxypass to virtualhost:81.
. I just sent you the zip of the bnsupport tool

Hi @reflexmania,

Varnish does not support https connections and that’s why we only configure it using http. If you want to use Varnish when receiving https requests, you will need to follow this guide to connect Apache HTTPS port with Varnish

https://docs.bitnami.com/aws/apps/magento/administration/configure-use-varnish/#use-varnishtm-with-ssl

Happy to help!


Was my answer helpful? Click on :heart: