Correctly handle the case when the request passes through one or more trustedProxies but no internalProxies. Based on a patch by zhanhb