Why do Errors Occur?

If you see an error message after integrating, it's usually something that's easily rectifiable! 

When you integrate with Ezoic, the system will act as a proxy between your site and your users. Without a proxy, requests for your content would come directly from the user's IP address. When Ezoic is turned 'on', requests will start coming via IP addresses from Amazon's Web Servers (AWS). This can sometimes be classified as 'bot' traffic by your server, or prevent users from accessing content behind a login. 


Which Error Messages Might I See?

If requests coming via Ezoic are classified as bot traffic, the following errors are examples of what you might see:

  • '500' error
  • Origin' error
  • '520' error
  • '403 Forbidden' error
  •  '401' error (which may read 'your IP has been used by spambots to register multiple times')
  • '503' error (which may be due to requests being timed out when connecting to the host server)


**If you are seeing a '404' error, or a '301 redirect' error, it's possible that there is an error at your host and you will need to contact them to check. It's also a good idea to check your DNS records match those you have entered at Ezoic and that your SSL settings are correct.


Solutions to Errors

There are three main options to help your host pass along requests from the Ezoic system, all three of which will be covered in this article:

(1) Whitelisting Ezoic's IP Addresses: choose this if your host is blocking requests coming via Ezoic's IP addresses. 

(2) User Agent Authentication: another option to prevent your host from blocking Ezoic's requests; this option allows your server to pass along requests that come via Ezoic.

(3) X-Forwarded-For - XFF or HTTP Header: this is the option to choose if you need your server to be able to see the 'real' IP of your user.



How do the Solutions Work?


1. Whitelisting Ezoic's IP Addresses:

In rare cases, your hosting company may inadvertently block Ezoic’s servers (AWS) from your site’s content. You may see a '403 Access Forbidden' error, 520, or 'Origin Error' when this occurs.

If the hosts are using IP addresses to block, please contact support@ezoic.com for Ezoic's range of IP addresses or see the attachment at the end of this article and send these to your host.


2. User Agent Authentication:

If your host cannot whitelist Ezoic's Ips, you can also ask them to set user agent authentication for 'X-middleton' (which comes with all requests). They need to look for 'X-middleton' in the header and allow all traffic through that has that.

This will authenticate the requests coming via Ezoic and stop them from getting blocked.


3. What is the X-Forwarded-For Header?

In plain English, the X-Forwarded-For header is a header field that you can use to make sure the 'real' IP of your users is passed along by a proxy like Ezoic or Cloudflare. Without this, only the IP of the proxy would be passed along. Some features (like login forms) might need to see the original user's IP. You can add this header to your server, or ask your host to do it for you. By implementing X-Forwarded-For on your site, Ezoic will send the IP address of the original web visitor through to your server in the X-Forwarded-For header.


How to Add the XFF?


  • In PHP it is available in: $_SERVER['HTTP_X_FORWARDED_FOR']
  • You need to put the code above in a file that all of your pages access (e.g. header.php, init.php or config.php)
  • You should see $_SERVER['REMOTE_ADDR'], which you can replace with $_SERVER['HTTP_X_FORWARDED_FOR']


  • In .NET it's available in:  HttpContext.Current.Request.Headers["X-Forwarded-For"]



How to Add the X-Forwarded-For Header on WordPress?


For Wordpress sites this process is a little different. 

  • To implement XFF for WordPress sites, simply copy and paste the code below to your theme's wp-config.php file:

// Use X-Forwarded-For HTTP Header to Get Visitor's Real IP Address


if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {

$http_x_headers = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );


$_SERVER['REMOTE_ADDR'] = $http_x_headers[0];


Help and Advice

If you need more advice on any of the information in this article, do not hesitate to reach out to your account manager or support@ezoic.com.