Yes, you need to set a Vary: Cookie
header to get the correct behaviour since different cookies would retrive different output.
You'll need also to take care of the cookie on vcl_recv
setting the appropriate X-UA-Device
in order to hash items correctly in varnish.