add dynamic cookie middleware for sessions