add middleware to support initialize_current_site