get protocol right if there is reverse proxy

use 'x-forwarded-proto' header to get right protocol if there is a reverse proxy