Fix the way port is determined if X-Forwarded-Port is missing.