Issues with force https, proxy and invitations

How are you setting the $scheme variable?