chevron_right
chevron_right
My Web Application (Code) Uses The IP Address Of Users And Stopped Working With Ezoic?
Technical Support/Troubleshooting

My Web Application (Code) Uses The IP Address Of Users And Stopped Working With Ezoic?

Last Updated a week ago
Article Navigation
Introduction
Common Symptoms
Troubleshooting
Tips for Prevention and Maintenance
Need Further Assistance?

Introduction

If your web application has stopped functioning correctly with Ezoic and you notice that it is no longer receiving the correct IP addresses for your visitors or is encountering a large number of duplicate IP addresses, this article is here to help. This troubleshooting guide will explain why this issue occurs and how to resolve it. Specifically, we will cover the importance of the X-Forwarded-For header in HTTP requests, how Ezoic uses this header to send the original visitor's IP address to your server, and alternative methods for retrieving the user's IP address through the 'x-middleton-ip' header. By the end of this article, you will have the necessary knowledge to adjust your code and ensure your web application receives the correct IP addresses once again.

Common Symptoms

Common symptoms indicating your code might not be properly configured to look at the X-Forwarded-For header include receiving incorrect IP addresses or numerous duplicate IP addresses. This issue often manifests in tracking logs and analytics, where you may notice that different users appear to have the same IP address or your visitor IP data appears inaccurate or incomplete.

Troubleshooting

If your application is no longer receiving the correct IP addresses of your visitors or is receiving a lot of duplicate IP addresses, follow these steps to troubleshoot and resolve the issue:

  1. Check the X-Forwarded-For Header:
    • Ensure that your code is correctly examining the X-Forwarded-For header.
    • In PHP, the X-Forwarded-For header can be accessed with $_SERVER['HTTP_X_FORWARDED_FOR'].
    • In .NET, it can be accessed using HttpContext.Current.Request.Headers["X-Forwarded-For"].
    • Verify that your code is correctly parsing the X-Forwarded-For header to extract the original IP addresses.
  2. Review the Use of Other Headers:
    • If you prefer not to use the X-Forwarded-For header, check the 'x-middleton-ip' header, which Ezoic uses to send the actual IP of the user.
    • Make sure your system is set up to use this header consistently if chosen.
  3. Verify Server Configuration:
    • Ensure that your server configuration allows the passing of these headers from the proxy to your application.

By following these troubleshooting steps, you can resolve issues with incorrect or duplicate IP addresses being recorded by your application.

Tips for Prevention and Maintenance

To ensure your application consistently receives the correct IP addresses of your visitors and avoids duplicate IP addresses, follow these best practices as also mentioned above:

  1. Implement the X-Forwarded-For Header: Ensure your application's code is configured to properly read the X-Forwarded-For header. This header is part of the HTTP standard and is widely used to pass the original visitor's IP address through intermediary services like Ezoic and ISPs.
  2. Verify Header Availability in Your Environment: Depending on your server environment, confirm that the X-Forwarded-For header is being read correctly. For instance:
    • In PHP, the header is available in $_SERVER['HTTP_X_FORWARDED_FOR'].
    • In .NET, it can be accessed through HttpContext.Current.Request.Headers["X-Forwarded-For"].
  3. Use the x-middleton-ip Header as a Fallback: Ezoic also provides the actual IP of the user under the 'x-middleton-ip' request header. If you prefer not to use the X-Forwarded-For header, ensure your application is set to look at the 'x-middleton-ip' header instead.
  4. Regularly Update and Check Your Code: Periodically review and update your code to ensure it continues to handle headers correctly, especially after any major updates to your server or application software.

By following these practices, you can maintain accurate IP tracking and avoid issues with duplicate IP addresses in your application.

Need Further Assistance?

If you need further assistance with seeing the real user IP, please log in via https://support.ezoic.com/ to make use of our dedicated resources for support. We're here to help!

Loading ...