IP of client when EspoCrm is behind a proxy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    IP of client when EspoCrm is behind a proxy

    Hello Yuri,

    i have try all (with my skill).. but with no result.. i can't have client IP in EspoCrm behind a proxy (nginx reverse proxy) .. only the IP of Proxy.

    do you think this is the solution ? or where i can write this kind of solution and test it ?
    Proxy send IP with header : HTTP_X_FORWARDED_FOR

    PHP Code:
    $ip = $_SERVER['REMOTE_ADDR']? : ( $_SERVER['HTTP_X_FORWARDED_FOR'] ? : $_SERVER['HTTP_CLIENT_IP'] ); 
    
    Regards
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,

    in application/espo/core/util/auth.php

    replace all $_SERVER['REMOTE_ADDR'] by $_SERVER['HTTP_X_REAL_IP']

    Regards
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • karlahodges
      Junior Member
      • Dec 2021
      • 1

      #3
      It is possible that the client also uses a proxy so that his IP cannot be traced.

      Comment

      • novastream
        Member
        • May 2021
        • 61

        #4
        Originally posted by karlahodges
        It is possible that the client also uses a proxy so that his IP cannot be traced.
        I run a Cloudflare proxy to a nginx proxy server that points to my webserver. Works great!

        Comment

        • DrucillaCorker
          Junior Member
          • Sep 2021
          • 2

          #5
          If EspoCRM doesn't have a built-in setting for handling forwarded headers, you may need to customize the application. This often involves modifying the code to correctly extract the client's IP from the headers. EspoCRM may have hooks or event handlers that you can use for this purpose.

          Comment

          • yuri
            Member
            • Mar 2014
            • 8444

            #6
            "ipAddressServerParam" config parameter: https://docs.espocrm.com/administration/config-params/
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            Working...