Support » Plugin: GeoIP Detection » Wrong IP detected / wrong country css class

  • I have enabled “Add a country-specific CSS class to the <body>-Tag.”
    Based on this I’ve implemented some CSS rules successfully. I tested them on our test environment with success.

    Unfortunately now that we’ve moved the site to our live environment the results are very different. It seems that on live the country classes are very different and in another country. Also, the IP test is not correct. Please see below:

    RESULTS LIVE ENVIRONMENT

    Current IP informations (as detected by the plugin)
    Detected client IP: 172.69.54.XX
    Real client IP (detected without the plugin): Failed: error
    External Server IP: 35.173.147.XX
    REMOTE_ADDR: 172.69.54.XX
    HTTP_X_FORWARDED_FOR: 83.83.153.XX

    RESULTS TEST ENVIROMENT

    Current IP informations (as detected by the plugin)
    Detected client IP: 83.83.153.XX
    Real client IP (detected without the plugin): Failed: error
    External Server IP: 52.204.22.XX
    REMOTE_ADDR: 83.83.153.XX
    HTTP_X_FORWARDED_FOR: (unset)

    In the live environment, we have a Cloudflare CDN. Would this be the problem?

    Would you know how this can be solved? I can pay for a working solution. Thank you.

    • This topic was modified 1 year, 4 months ago by Ramzii.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Benjamin Pick

    (@benjamin4)

    If you are behind cloudflare, you need to enable the reverse proxy option. Other than that, it should work …

    Thanks! I enabled it. Now the live environment gives me:

    Current IP informations (as detected by the plugin)
    Detected client IP: 83.83.153.XX
    Real client IP (detected without the plugin): Failed: error
    External Server IP: 35.173.147.XX
    REMOTE_ADDR: 141.101.104.XX
    HTTP_X_FORWARDED_FOR: 83.83.153.XX
    
    Use reverse proxy: yes
    Enable this option if REMOTE_ADDR is not the correct client IP.

    Does this seem right?

    The body class still is giving me an incorrect location in the US. While it should be in the EU.

    Plugin Author Benjamin Pick

    (@benjamin4)

    The question is: is 83.83.153.XX your client ip or is it a cloudflare server or proxy? Visit whatismyip.com or similar to check.

    Normally the correct ip should be shown at “real client IP” but somehow it doesn’t work for you. Which browser are you using? Can you open the Developer-Tools of the browser and check if there error messages at the console (why the connection to the IP server failed?)

    It seems all works good now! Thank you so much. That is indeed my correct IP.

    I’m not sure why “real client IP” keeps failing. Im using the latest chrome. Nothing special. Even in incognito with all addons turned off it still doesnt work.

    Im afraid we have been experienced wrongfull location detection. It seems to change every day.. I think it is the Cloudflare CDN that is influencing how the site sees the location of the visitor.

    Im out of options, could you perhaps shine a light on this?

    The settings have not changed since my last post.

    Plugin Author Benjamin Pick

    (@benjamin4)

    Maybe cloudflare is switching between different infrastructure endpoints (e.g. geo-dependent DNS resolution)? Did you try the cloudflare geo-detection option? I’m not sure if it is available for all cloudflare plans.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Wrong IP detected / wrong country css class’ is closed to new replies.