0

hi this is my varnish log for the main website page https://pastebin.com/RxsPKe7z

here is the hash things on my * vcl,it shows a good hit but why Im getting the hash returns?

-I have other pages that also sets WordPress logged in cookie for guests, i will share it on another question

  • vcl recive

      if (req.url ~ "^[^?]*\.(7z|avi|bz2|flac|flv|gz|mka|mkv|mov|mp3|mp4|mpeg|mpg|ogg|ogm|opus|rar|tar|tgz|tbz|txz|wav|webm|xz|zip)(\?.*)?$") {
    unset req.http.Cookie;
    return (hash); }
    
    
                 if (req.url ~ "^[^?]*\.(7z|avi|bmp|bz2|css|csv|doc|docx|eot|flac|flv|gif|gz|ico|jpeg|jpg|js|less|mka|mkv|mov|mp3|mp4|mpeg|mpg|odt|otf|ogg|ogm|opus|pdf|png|ppt|pptx|rar|rtf|svg|svgz|swf|tar|tbz|tgz|ttf|txt|txz|wav|webm|webp|woff|woff2|xls|xlsx|xml|xz|zip)(\?.*)?$") {
    unset req.http.Cookie;
    return (hash);
    

    }

    sub vcl_hash {
       # Called after vcl_recv to create a hash value for the request. 
      This is used as a key
      # to look up the object in Varnish.
    
    
    
      hash_data(req.url);
    
      if (req.http.host) {
        hash_data(req.http.host);
      } else {
        hash_data(server.ip);
      }
    
    
    
    #https://docs.woocommerce.com/document/woocommerce-cookies/
    if (req.http.cookie ~ "woocommerce_items_in_cart") {
    set req.http.X-TMP2 = regsub(req.http.cookie, ".*woocommerce_items_in_cart([^;]+);.*", "\1");
    hash_data(req.http.X-TMP2);
    unset req.http.X-TMP2;}
    
      if (req.http.cookie ~ "woocommerce_cart_hash") {
    set req.http.X-TMP3 = regsub(req.http.cookie, ".*woocommerce_cart([^;]+);.*", "\1");
    hash_data(req.http.X-TMP3);
    unset req.http.X-TMP3;}
    
    
     if (req.http.cookie ~ "woocommerce_session_") {
    set req.http.X-TMP4 = regsub(req.http.cookie, ".*woocommerce_session([^;]+);.*", "\1");
    hash_data(req.http.X-TMP4);
    unset req.http.X-TMP4;
     }
    
    
    
    return (lookup);
    }
    

I want to make sure that I'm on the right track

best.

ahmad
  • 3
  • 3
  • this is one on my subpages https://pastebin.com/3vh3Rcsf which shows HIT only on refresh for each session – ahmad May 20 '17 at 13:59
  • You can use this guide (http://shakeelmuhammad.blogspot.com/2017/05/setup-varnish-4-and-w3-total-cache.html) to configure varnish for wordpress. – mshakeel Jun 07 '17 at 07:40

0 Answers0