Added middleware to upate the scheme in the env based on the header.