Base solution for your next web application
Open Closed

Audit log is not showing client's IP behind reverse proxy and docker container #9748


User avatar
0
ipservant created

Prerequisites

  • What is your product version? -> 8.1
  • What is your product type (Angular or MVC)? -> Angular
  • What is product framework type (.net framework or .net core)? -> .net core

Hello guys,

I have one more issue with the cloud setup that contains of a firewall port forwarding to NGINX (reverse proxy, SSL offloading) and dockered host/ng. The audit log is now showing the docker network's gateway IP only instead of the actual client's IP. A similar thread regarding Abp can be found here: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/5359

Can you please advice how we should solve this for Zero 8.1 ASP.NET CORE & Angular .NET Core 3.0 package?

Thanks!


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can forward the real IP in nginx and then rewrite the GetClientIpAddress method of HttpContextClientInfoProvider to get the info in the request header.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Mvc/Auditing/HttpContextClientInfoProvider.cs#L37

  • User Avatar
    0
    ipservant created

    Hi,

    thanks for the quick reply, unfortunately I can't find that file or GetClientIpAddress by global search in the whole project (Angular / .net core, separate projects). Can you give me a hint where to look at?

  • User Avatar
    0
    maliming created
    Support Team

    Hi

    This method exist in aspnetboilerplate.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/35cb7f6be1b9a8a17f64f83f82567c09b2c5bf07/src/Abp.AspNetCore/AspNetCore/Mvc/Auditing/HttpContextClientInfoProvider.cs#L37