Added check for HTTP_X_FORWARDED_PROTO. Closes #3322