Re: Cookies in VCL

2008-04-14 Thread Florian Engelhardt
On Tue, 8 Apr 2008 11:22:47 +0200
[EMAIL PROTECTED] wrote:

 A question about cookies in VCL.
 
 Is there a way of handling cookies in VCL?
 
 Like: 
 if(req.http.Cookies[userid] == 1234)
 
 or
 
 set req.http.Cookies[language] = sv

Kind of. vcl_recv looks like this:
sub vcl_recv {
 if (req.request != GET  req.request != HEAD) {
   pipe;
 }
 if (req.http.Expect) {
   pipe;
 }
 if (req.http.Authenticate || req.http.Cookie) {
   pass;
 }
 lookup;
}

I changed it to this:
sub vcl_recv {
 if (req.request != GET  req.request != HEAD) {
   pipe;
 }
 if (req.http.Expect) {
   pipe;
 }
 if (req.http.Authenticate || req.http.Cookie ~ PHPSESSID) {
   pass;
 }
 lookup;
}

The change ist, that if somewhere in the Cookie-Header we have a
PHPSESSID-String i pass it. The Problem ist, that in our application
we are using Cookies in JavaScript. So nearly every page will be
passed by varnish, couse the browser will send the cookies set by
javascript to the server. In the new vcl_recv it ignores all other
cookies.
The only problem is, if some cookie's value would be PHPSESSID, than
the request will also be passed.

Kind regards

Flo
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: Cookies in VCL

2008-04-08 Thread Poul-Henning Kamp
In message [EMAIL PROTECTED], [EMAIL PROTECTED] writes:
A question about cookies in VCL.

Is there a way of handling cookies in VCL?

Not yet, but it's on our list.


Like: 
if(req.http.Cookies[userid] == 1234)

or

set req.http.Cookies[language] = sv

Thanks
Erik

___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED] | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc