I need to rewrite domain.com
to www.domain.com
using varnish. I have already done that for Nginx. But no Idea how to do in varnish.
Let me explain why I want to do that, if my approach is wrong then please correct me.
Whenever I hit the site with domain.com
I have a cookie with path .domain.com
. Whenever I hit the path with www.domain.com
it creates a new cookie with path .www.domain.com
Now these two cookies for same user is creating session issues.
I am hoping that if my servers only receive request like www.domain.com
then there will be no scope of cookie associated with domain.com
So Ideally, Question is, is rewrite a good approach ? If yes then how to do that with varnish, I have already tried with Nginx but no luck.
Any guidance is deeply appreciated. Thanks guys.