I am using an Azure WebApp (docker-compose) which has Nginx as reverse proxy and .net core app. Last year our number of clients increased a lot and we started using Azure Front Door as CDN for caching static content. Problem is now we no longer are able to get client IP address for our logging SQL table.
This is the code that works without the AFD:
Nginx default.conf:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
Dotnet Startup.cs:
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
But adding the AFD it always gets the IP address of the CDN.
I know AFD passes X-Azure-ClientIP header, but I was not able to get it in Nginx or dotnet.
Do you know how can I get real client IP address using Azure Front Door, Nginx and dotnet core?
Thanks in advance.

It worked this way:
dotnet: