Flexible session middleware for WAI