Open Closed

Get wrong client IP Address running on docker #3387


User avatar
0
isaac.yip@cpy.com.hk created
  • ABP Framework version: v5.3.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I am running microservice on docker with a bridge network. Using HttpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(), and it return the bridge gateway.

How to get the correct client ip address?


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Blazor wasm or Blazor server?

  • User Avatar
    0
    isaac.yip@cpy.com.hk created

    Blazor server

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to configure the forwarding header.

    https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-6.0 https://blog.sinenie.cl/blog/forwarded-headers/

  • User Avatar
    0
    scottie.tang@cpy.com.hk created

    Hi thanks, we are able to create a reversed proxy and add real IP to the request headers. We can retrieve the visitor IP address from those headers, however we want to know is there anything we need to apply/implement in abp modules in order to let us get remote ip via context.RemoteIpAddress ?

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/dotnet/AspNetCore.Docs/issues/21615#issuecomment-786311147

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09