how to use varnish cache with set-cookie named mp3list and phpsessionid -


i new php , interested use varnish improve site performance..

i installed varnish latest version : 4.0.2 varnish

http/1.1 200 ok date: sat, 06 dec 2014 07:24:47 gmt server: apache/2.2.29 (unix) mod_ssl/2.2.29 openssl/1.0.1e-fips mod_bwlimited/1.4 x-powered-by: php/5.4.34 expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache set-cookie: phpsessid=86dc704d405a80d0c012de043cd9408b; path=/ set-cookie: mp3list=wdvmg2g4; expires=tue, 03-dec-2024 07:24:47 gmt vary: accept-encoding content-type: text/html x-varnish: 2 age: 0 via: 1.1 varnish-v4 connection: keep-alive

i use cookie named ( mp3list , phpsessionid) cant cache pages,,

i used vcl

$sub vcl_recv {   call normalize_req_url; set req.http.cookie = regsub(req.http.cookie, "^;\s*", ""); # happens before check if have in cache already. # # typically clean request here, removing cookies don't need, # rewriting request, etc. # if requested url starts "/cart.asp" pass given # backend , not cache result ("pass" means "bypass cache"). if (req.url ~ "^/playlist\.php$") {    return (pass);    } } sub vcl_backend_response {  # happens after have read response headers backend.  #  # here clean response headers, removing silly set-cookie headers  # , other mistakes backend does.  if (beresp.http.set-cookie)  {   set beresp.http.set-cookie = regsub(beresp.http.set-cookie, "^php","");   if (beresp.http.set-cookie == "")     {         unset beresp.http.set-cookie;     }   }  unset beresp.http.cache-control;  set beresp.http.cache-control = "public";  }  sub vcl_deliver {  # happens when have pieces need, , send  # response client.  #  # can accounting or modifying final object here.  # hit or miss?   if ( obj.hits > 0 )  {   set resp.http.x-cache = "hit";  }  else  {   set resp.http.x-cache = "miss";  }   # , add number of hits in header:   set resp.http.x-cache-hits = obj.hits;  }  sub normalize_req_url {  # strip out google analytics campaign variables. needed  # javascript running on page  # utm_source, utm_medium, utm_campaign, gclid, ...  if(req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|mr:[a-z]+)=") {     set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|mr:[a-               z]+)=[%.-_a-z0-9]+&?", "");   }   set req.url = regsub(req.url, "(\?&?)$", "");   }   sub vcl_hash {   hash_data(req.url);   if (req.http.host) {   hash_data(req.http.host);   } else {   hash_data(server.ip);   }   hash_data(req.http.cookie);   }   

now removed mp3list using this,, still phpsessid there,, how remove phpsessid

http/1.1 200 ok date: sat, 06 dec 2014 07:44:46 gmt server: apache/2.2.29 (unix) mod_ssl/2.2.29 openssl/1.0.1e-fips mod_bwlimited/1.4 x-powered-by: php/5.4.34 expires: thu, 19 nov 1981 08:52:00 gmt pragma: no-cache vary: accept-encoding content-type: text/html set-cookie: phpsessid=ce934af9a97bd7d0fd14304bd49f8fe2; path=/ cache-control: public x-varnish: 163843 age: 0 via: 1.1 varnish-v4  x-cache: miss x-cache-hits: 0 connection: keep-alive 

can plz guide me how bypass phpsessid , edit vcl , use varnish

advance ........

as noticing php sessions , varnish not intermix nicely, ie phpsessions destroys cachebility of urls within varnish makes them unique.

options: 1. disable php sessions altogether (doubt thats real option you). 2. enable php sessions on pages absolutely need it, rest can cached. 3. split session-related php logic separate php files , include using esi main pages. allow partially cache pages (the non-esi bits).


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -