Travis wrote:
 > Sorry if this is on the ineternet somewhere, but I have yet to find it.

 > Can Varnish set a cookie?

> In example, if a user on a mobile device goes to xyz.com, Varnish sees a 
> mobile user agent and redirects them to m.xyz.com via the vcl_error 
> section.  Before or after the redirect, can Varnish set a cookie without 
> the application doing so?

> Thanks,
> Travis

I'm running varnish 2.0.5 but would not expect the syntax to have changed much.
The obj part may no longer be what is used, I believe the current versions use 
beresp.

I use the code below in vcl_fetch.
   If (test for setting cookie) {
        set obj.http.Set-Cookie = "use_mobile_dev=yes; domain=.<xxxxxxxx>.com; 
path=/";
   }

This works for the limited case where I need it.  I don't remember the impact 
if any 
Set-Cookie headers already exist.

Jim

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to