setting up Application load balancer with Global accelerator with Nginx target group upstream to IIS

I have set up an application Load balancer with Global accelerator and Nginx Proxy pass to different IIS upstream based upon hostname. The website works well and can access the websites globally. some times customers had issues accessing websites with 500 error codes. we have an error logger configured with our app we can see double IP addresses in ROMOTE_ADDR for some of the request

For requests with double ip addresses, it throws a 500 Internal server error. and other request with single IP address are good

nginx.conf

proxy_set_header        Host $host;
  proxy_set_header        Connection "";
  proxy_set_header        X-Real-IP $http_x_forwarded_for;
  proxy_set_header        remote_addr $http_x_forwarded_for;
  proxy_set_header        X-Forwarded-For $http_x_forwarded_for;
  proxy_hide_header        Server;
  proxy_hide_header        X-Powered-By;
  proxy_hide_header        X-AspNet-Version;
  proxy_headers_hash_bucket_size 64;

  real_ip_header   X-Forwarded-For;
  set_real_ip_from 10.15.0.0/16;
  real_ip_recursive on;

enter code here

virtual host

proxy_pass            http://www-servers;
    proxy_read_timeout    90;
    proxy_connect_timeout 90;
    proxy_http_version    1.1;
    proxy_set_header      Host $host;
    proxy_set_header      Connection "";
    proxy_set_header      X-Real-IP $http_x_forwarded_for;
    proxy_set_header      remote_addr $http_x_forwarded_for;
    proxy_set_header      X-Forwarded-For $http_x_forwarded_for;
    proxy_hide_header      Server;
    proxy_hide_header      X-Powered-By;
    proxy_hide_header      X-AspNet-Version;





double ip address   -  Double IP Address: 72.194.29.174, 104.129.198.101

sometimes there are three IP addresses

Double IP Address: 73.223.72.109, 172.18.0.3, 64.62.158.119

what header we can set to get the correct IP address and prevent some connection to log double ip's

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum