0
通過試驗Azure負載平衡集,似乎x-forwarded-for報頭未被使用(正如在常規負載均衡器中預期的那樣),而是它們保留原始客戶端IP。Azure負載均衡集保留了客戶端IP
例如爲:
app.get('/my-ip', function(req, res) {
winston.log('/my-ip', 'x-forwarded', req.headers['x-forwarded-for'] || 'none', 'remoteAddress', req.connection.remoteAddress || 'none');
res.end();
});
有了結果:
/my-ip x-forwarded none remoteAddress MY_CORRECT_IP
可這種行爲進行確認和依靠?
+1這不是代理。這裏有一些額外的有用信息:https://azure.microsoft.com/en-us/documentation/articles/load-balancer-overview/ –
感謝您的澄清,我習慣了Amazon ELB,它使用x轉發 – SyBer
@SyBer - 當您將負載平衡配置爲在不同類型的協議之間進行轉換時,Amazon ELB僅使用X-Forwarded-for。例如,HTTPS轉換爲HTTP。請參閱:http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-listener-config.html「當您將TCP(第4層)用於前端和後端連接時,您的負載平衡器將請求轉發到後端實例而不修改標頭。「然後「使用此配置,您將不會收到會話粘性或X-Forwarded標頭的cookie」,或者您明確啓用它。 –