i just said : thanks for your help ! <br><br>but i speak chines somewhere <br><br>next time , i try your help <br><br><br><div class="gmail_quote">On Wed, Mar 28, 2012 at 10:35 PM, James Light <span dir="ltr"><<a href="mailto:j.gareth.light@gmail.com">j.gareth.light@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><div></div><div class="h5">On Wed, Mar 28, 2012 at 4:04 PM, Per Buer <span dir="ltr"><<a href="mailto:perbu@varnish-software.com" target="_blank">perbu@varnish-software.com</a>></span> wrote:<br>
<div><div>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Wed, Mar 28, 2012 at 8:25 PM, James Light <span dir="ltr"><<a href="mailto:j.gareth.light@gmail.com" target="_blank">j.gareth.light@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What you asked was how to remove every *other* cookie *except* PHPSESSID.<br>
<br>
There is an example of how to do that on the varnish site here:<br>
<a href="https://www.varnish-cache.org/docs/3.0/tutorial/cookies.html" target="_blank">https://www.varnish-cache.org/docs/3.0/tutorial/cookies.html</a><br>
<br>
Personally, I prefer a different way, which amounts to:<br>
* extract the PHPSESSID into a different header<br>
* unset the entire Cookie Header<br>
* add back only the PHPSESSID as the Cookie header<br></blockquote><div><br></div><div><br></div></div><div>Thats quite a neat way to do it. Could you send me the VCL for this? It might be a good example for the docs. The current example is rather horrid.</div>
<span><font color="#888888">
<div><br></div><div><br></div></font></span></div><span><font color="#888888">-- <br><img src=""><div>Per Buer<br>Phone: <a href="tel:%2B47%2021%2098%2092%2061" value="+4721989261" target="_blank">+47 21 98 92 61</a> / Mobile: <a href="tel:%2B47%20958%2039%20117" value="+4795839117" target="_blank">+47 958 39 117</a> / Skype: per.buer<br>
<i>Varnish makes websites fly!</i><div><a href="http://www.varnish-software.com/whitepapers" target="_blank">Whitepapers</a> | <a href="http://www.youtube.com/watch?v=x7t2Sp174eI" target="_blank">Video</a> | <a href="https://twitter.com/varnishsoftware" target="_blank">Twitter</a> <br>
<br></div></div><br>
</font></span></blockquote></div><br></div></div></div></div><div>I've adapted this off the cuff from what I have internally currently where I'm working. I have not done extensive testing on this as it is simply an adaptation of what I actually do in our vcl code. Let me know any problems that I have overlooked.</div>
<div><br></div><div>This attempts to match a PHPSESSID that is one or more ASCII alphanumeric character. I'm not a PHP developer, I just asked the PHP guy if I can always expect that the PHPSESSID will consist of only alphanumerics and he said yes it will.</div>
<div><br></div><div>This will not work for a cookie that has a string that contains characters that are not ASCII alphanumerics. I'm not sure if rfc2616 has any restrictions on the Character Encoding for Cookies, so I can't guarantee that this will work in all cases and I currently don't have the time to look into the spec to make sure that what I'm giving doesn't totally suck.</div>
<div><br></div><div>Basically, I'm just posting this here because you asked me to, I don't claim to be an expert in anything except persistence.</div><div><br></div><div>--------8<--------</div><div><div>sub vcl_recv {</div>
<div> </div><div> # save the original cookie header so we can mangle it</div><div> set req.http.X-Varnish-PHP_SID = req.http.Cookie;</div><div><br></div><div> # using a capturing sub pattern, extract the continuous string of alphanumerics that immediately follows "PHPSESSID="</div>
<div> set req.http.X-Varnish-PHP_SID = regsuball(req.http.X-Varnish-PHP_SID, ";? ?PHPSESSID=([a-zA-Z0-9]+)( |;| ;).*","\1");</div><div> </div><div> set req.http.Cookie = req.X-Varnish-PHP_SID;</div>
<div> </div><div> remove req.X-Varnish-PHP_SID;</div><div> </div><div>} </div><div>--------8<--------</div></div><div><br></div><div>Hope this helps.</div><div> -jlight</div>
</div><br>
<br>_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br></blockquote></div><br><br clear="all"><br>-- <br>Alexandre Priou <br>
Analyste Concepteur Web <br>64 rue de l'Essonne <br>91000 Évry<span></span><br>tel_perso : 06.14.83.81.03<br><br><br><br>