Açık Kapalı

Get wrong client IP Address running on docker #3387


User avatar
0
isaac.yip@cpy.com.hk oluşturuldu
  • 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 Cevap
  • User Avatar
    0
    maliming oluşturuldu
    Destek Takımı Fullstack Developer

    hi

    Blazor wasm or Blazor server?

  • User Avatar
    0
    isaac.yip@cpy.com.hk oluşturuldu

    Blazor server

  • User Avatar
    0
    maliming oluşturuldu
    Destek Takımı 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 oluşturuldu

    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 oluşturuldu
    Destek Takımı Fullstack Developer

    hi

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

Made with ❤️ on ABP v8.2.0-preview Updated on Mart 25, 2024, 15:11