Answering myself: if instead of redirect '/', I call template 'index' after setting the session, then it works as expected. (Well, except that the URL now stays as it was which is not that nice). As far as I can understand from the Dancer2 docs, this should work with redirect as well. Gabor