handles cookies for rendr both client and server side