The application is running under a load balancer(aws) and the machines are Linux. Client IP is showing 127.0.0.0. The nopCommerce version is 4.5.x. Can anyone please help me to figure out it?
Because load balancers intercept traffic between clients and servers, your server access logs only contain the IP address of the load balancer.
The data you are looking for is in the "X-Forwarded-For" request header https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html
Have you enabled the UseHttpXForwardedProto setting in the appsettings.json
Because load balancers intercept traffic between clients and servers, your server access logs only contain the IP address of the load balancer.
The data you are looking for is in the "X-Forwarded-For" request header https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html
Have you enabled the UseHttpXForwardedProto setting in the appsettings.json
Thanks MikeEpprecht for your answer. Yes I enabled it and now it is showing a private IP like 10.0.10.121. The http to https redirection from cloudflare.
listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/yourstore.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/yourstore.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot #include snippets/self-signed.conf; #include snippets/ssl-params.conf;
}
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
Then from nopCommerce side, I need to add all the loadbalancer IP as KnownProxies. The HostingConfig of appsettings.json(Nop.Web==>App_Data==>appsettings.json) should look like